从配置文件字段中删除社交网络链接

时间:2014-02-18 08:39:10

标签: wordpress wordpress-plugin hook

我在网上看到了一些用于删除和添加联系人字段的代码(通过挂钩)。但似乎没有任何摆脱你在WordPress配置文件部分中看到的社交网络字段。

enter image description here

这是代码,是否有删除社交网络字段的钩子?我正在使用一个名为WP User Frontend的插件,它正在将这些字段拉进去。

function modify_contact_methods($profile_fields) {
    // Add new fields
    $profile_fields['twitter'] = 'Twitter Username';
    $profile_fields['facebook'] = 'Facebook URL';
    $profile_fields['gplus'] = 'Google+ URL';

    // Remove old fields
    unset($profile_fields['google']);

    return $profile_fields;
}
add_filter('user_contactmethods', 'modify_contact_methods');

1 个答案:

答案 0 :(得分:0)

创建一个非常简单的插件,等待加载其他插件,然后使用remove_filter函数pfefferle mentions in a comment删除其他插件添加的钩子。

<?php
/**
 * Plugin Name: (SO) Remove WP User Frontend contact methods
 */

add_action( 'plugins_loaded', 'remove_custom_user_contact_methods' );

function remove_custom_user_contact_methods()
{
    remove_filter( 'user_contactmethods', 'modify_contact_methods' );
}