WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am sorting results appear on the category archive page using these filters: posts_join and posts_orderby. There is a widget, which displays recent posts. I am using default recent posts widget of WordPress. But it's not showing any result. When I investigated I found that the applied filters are getting applied to this query. So, I tried remove the filters using the following code:

remove_filter('posts_join', 'my_filter_join');
remove_filter('posts_orderby', 'my_filter_orderby');

But still it does not work.

I also tried to put the following code in the filter functions itself:

// Disable this filter for future queries!
remove_filter(current_filter(), __FUNCTION__);

It does not work either.

How to fix this issue?

share|improve this question
What priority are you assigning to your filters with add_filter()? If it's different than the default, then you need to use the same priority with remove_filter(). So, for example, if you have add_filter( 'posts_join', 'my_filter_join', 20 );, you would need to have remove_filter( 'posts_join', 'my_filter_join', 20 ); to remove it. – Pat J Sep 11 '13 at 13:16
I am using default priority. For example, add_filter('posts_join', 'my_filter_join');. – Debiprasad Sep 11 '13 at 13:39
In principle, what you are doing looks right. Post your code in context please, so we can see how it is actually being used. – s_ha_dum Sep 11 '13 at 14:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.