Tag Info

Hot answers tagged

3

Is this possible via query args? I don't think so. Is this possible via 'posts_where'? It is probably doable using some 'posts_*' filters, not only with 'posts_where'. Or maybe using 'posts_request' filter to completely oveeride the query. Do I need to run a separate query and then somehow merge the results? That would be the simplest ...


3

Here is another approach with pre_get_posts. Use get_posts() ( x2 queries ) to get all the post ids of each post type according to its requirements. Add the fields parameter ('fields' => 'ids') to your query arguments to just fetch post ids as this is what we need, nothing else. This will drastically improve performance and will not be that tough on ...


2

You can ignore sticky posts by adding 'ignore_sticky_posts' => true, to your query. You can also set ignore_sticky_posts to 1. Please note that a post is still delivered if it is sticky, but matches the other criterias.


2

To narrow down the possible causes I'd strongly recommend using a debugging plugin on your development server, like Query Monitor, so you can see the SQL being generated by your query. Alternatively check the request property of your $wp_query object. It's always possible, if you only recently installed the plugin, that there aren't any posts with that post ...


1

Per the comment from @ialocin I switched from WP JSON API to WP REST API. There is much less documentation with the rest api but it's customizable using native wordpress functions. Also, it has a nifty github plugin for allowing use with ACF custom fiends. Anyway, the documentatino for customization the wp rest api is terrible so I'm going to show you what ...


1

Custom queries and sticky posts are quite a curve ball to work with. I don't know how your setup looks and what exactly is your user case, but your best solution here would be to run two queries here, the first one to get your sticky posts and the other one to display normal posts Your first query's arguments will look something like $args = array( ...



Only top voted, non community-wiki answers of a minimum length are eligible