This is not trivial, because “home,category and search” are logically determined while main query churns through stuff. I am pretty sure I read this is possible, but that was in context of syndicating site that hadn’t used posts/loop at all and scrapped it to do different stuff.
More typical approaches are:
-
Integrate custom logic into main query, by using
pre_get_posts
,posts_*
and other relevant filters. -
Leave main query for one of loops and implement other loops as secondary.
Related Posts:
- How to make WP_Query ‘post__in’ accept an array?
- ajax category filter
- Display posts the match taxonomy term linked from wp_list_categoies?
- WordPress 4.9.5 PHP intermittent warning trim() expects parameter 1 to be string, array given
- Merging multiple wp_query objects
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- Using custom meta_query with relation not working as expected
- How to support multiple search terms query within one process?
- get data from wp-query, outside the loop & without url change
- Order by the results of a function with WP_query
- Pagination not working for category posts
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- How to use WP_Query to filter posts modified after a specific date
- tax_query shows no results if nothing is selected
- meta_key and meta_value not working together
- Select random post every day
- Include Sticky Posts with Custom Query
- Order WP Query posts by custom order calculated from post meta values
- How to query for custom field within Gutenberg block from outside of that post? [closed]
- WP_Query mixe post and page attributes
- get_query_var returns null
- post thumbnail not showing up with shortcode
- Wp query orderby ‘title’ doesn’t work
- How do you Query posts with nothing in common?
- Meta query with JSON value
- Prevent duplicate post from dynamic multiple loops
- Get meta info related to current post
- When to add_filter() to Custom Query
- if/else on custom query gives 200 OK when condition not met?
- Can I count matches without doing a query?
- Store sticky post’s ids in a transient
- How to detect if query is runned from widget?
- Using meta_query with multiple keys and compare values
- Woocommerce query all products and categories
- Add “Category” to Mysql Query
- Can I set my WP_Query to be a Main Query?
- Sort wordpress custom posts based on meta value
- How to use external API content in place of WP posts using $wp_query?
- Is it possible to set specific posts to show first in a query?
- How to make search for posts using get method?
- wp_query args adding muitiple tax_querys
- Exclude some authors from query
- WP_Query posts with comments only
- Default permalink structure causing Notice: Undefined property: WP_Query::$post
- wp_query serialised array
- Conditional operator OR not working with custom fields
- How to add custom meta to ‘pre_get_terms’?
- How do I check if an article is popular this week?
- Get posts that do not have the same tags as current
- Using Transients
- Should I reset $wp_query?
- Exclude a Woocommerce product from WP_Query
- Sorting search results with custom dropdown
- Posts query according to meta box date
- create metabox to activate slider
- Expecting statement error from php loop using ACF plugin
- Get specific ACF key and value from all posts – no access to DB
- problem with loop
- How do I sort this custom list of sticky posts
- WP_Query will not display draft posts
- All Posts Have The Same Comments
- Trying to get property of non-object in: $wp_query
- I am officially missing something about transient posts
- Register Taxonomy – What is `query_var`?
- How do I get the content of a custom instance of WP_Query?
- Change post query onclick
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- WP_Query, Paginate by Custom Field
- Query post and sort by custom value calculated with custom field on cpt
- Block internal search queries with pre_get_posts and regex rules
- WP_Query() not working as expected
- How to sort store location by specific category order in WP store locations
- Is it possible to give a classname to specific comments in the WordPress admin?
- Posts per Page not working
- Trouble with serialized metadata
- Custom filter from post meta
- Is there documentation for objects returned by WP_Query?
- Custom post type loop error: Trying to get property of non-object
- Search Field that allows options of “Match any keyword” or “Match all keywords”
- Saving custom fields for WP_Query to retrieve
- Getting the last X posts, but in ascending order of time
- Modify query to exclude certain ids and certain parents and its corresponding children
- How to fix pagination for custom loops on front-page.php
- Show more than one post on the main page excluding certain category
- How to make a wordpress loop file that displays posts based on certain conditions
- WP_Query with MetaQuery issue
- Cannot order by in WP_Query
- How to sort a WP_Query array by post_name after an array_merge();
- Comment count same for every post in homepage WP_Query
- How do I display posts with specific value in a custom field into my loop?
- Order by multiple meta keys on wordpress
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- WP_Query breaks pagination
- wpdb LIKE request shows all database data
- Incorrect posts displayed on category page
- WP_Query sort by ACF date field (newest first) with blank dates first
- Pagination only showed when no category is set in wp_query
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2
- Prevent URL Parameter Affecting other WP Query