I've added a custom filter function for the_posts
filter in a plugin.
add_filter('the_posts', 'posts_filter');
function posts_filter() { … }
This works pretty well in the main loop, that means the posts are filtered in the way I defined in the posts_filter
function.
But I am calling get_posts()
within an ajax request to get some posts. And there the filters aren't working. query_posts()
or custom wp_query
don't work too.
So the question is: How can I get posts beside the main loop which are filtered by the_posts
filter?