我为添加了自定义筛选函数the_posts
在插件中筛选。
add_filter(\'the_posts\', \'posts_filter\');
function posts_filter() { … }
这在主循环中运行得很好,这意味着帖子会按照我在posts_filter
作用但我正在打电话get_posts()
在ajax请求中获取一些帖子。在那里,过滤器不起作用。query_posts()
或自定义wp_query
不要工作太多。
所以问题是:我如何才能在主循环旁获得按the_posts
滤器