## php – How can I remove a function that has been added to wordpress with add_filter?

Question

to begin with I am trying to modify a wordpress plugin.

I have created a function named fuxia_is_the_best. Then I add this function to the sanitize_title filter, with the use of this code:

add_filter('sanitize_title', 'fuxia_is_the_best');


and this add_filter function goes inside an if statement:

if ( \$lama == 'green' ) {
} else {
remove_filter('sanitize_title', 'fuxia_is_the_best');
}


If you noticed I have an else statement in which I’m using the remove_filter() function.
But there goes my problem and the cause of this question in general. The remove_filter()
doesn’t actually remove the filter :/ .

Question:

• What could have gone wrong?
• Is there anything wrong in this php code above?

closure: