最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin5浏览0评论

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' ) {
  add_filter('sanitize_title', 'fuxia_is_the_best');
} 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: Thanks in advance for your time, you're awesome!

发布评论

评论列表(0)

  1. 暂无评论