I am trying to remove two contactmethods that were set by a plugin. I've read a lot about adding/removing an action, but found little on adding/removing a filter.
Original plugin code:
function pg_contactmethods( $contactmethods ) {
$contactmethods[ 'twitter' ] = 'Twitter';
$contactmethods[ 'facebook' ] = 'Facebook';
unset( $contactmethods[ 'aim' ] );
unset( $contactmethods[ 'yim' ] );
unset( $contactmethods[ 'jabber' ] );
return $contactmethods;
}
add_filter( 'user_contactmethods', 'pg_contactmethods', 10, 1 );
I can comment out the Twitter and Facebook lines and that works, but I don't want to modify the original plugin.
I have create a functionality plugin and added the following line:
remove_filter( 'user_contactmethods', 'pg_contactmethods', 10, 1 );
Nothing changed.
Tried using just these two lines in a new function:
unset ( $contactmethods[ 'twitter' ] );
unset ( $contactmethods[ 'facebook' ] );
Nothing changed.
Tried the following remove_filter/add_filter in my functionality plugin:
remove_filter ('user_contactmethods', 'pg_contactmethods', 10, 1);
add_filter ('user_contactmethods', 'my_contactmethods', 10, 1);
function my_contactmethods( $contactmethods ) {
//$contactmethods[ 'twitter' ] = 'Twitter';
//$contactmethods[ 'facebook' ] = 'Facebook';
unset( $contactmethods[ 'aim' ] );
unset( $contactmethods[ 'yim' ] );
unset( $contactmethods[ 'jabber' ] );
return $contactmethods;
}
Again, nothing changed.
Any advice on what I'm doing wrong?
Edit: I'm using WP 4.3.1, with a child theme.