Unfortunately no one answers my question so I will show my way to solve this problem.
I use public query vars with get_query_var
and set_query_var
functions to set widget__exclude
variable across all queries.
Still not sure that it is the best way for this case but hope it helps somebody.
Related Posts:
- Prevent duplicate post from dynamic multiple loops
- WP_Query offset is returning post from prevois loop
- Prevent Duplicate Post Counted by Query
- why ignore_sticky_posts in sticky post query
- Does tax_query really beats meta_query in all situations?
- WP_Query by post ID doesn’t work if post is in custom post_status
- Tracing the life of a query
- WP_Query orderby taxonomy term value (numeric)
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- How to get post meta value and post in one query?
- WP Query and order by particular specified IDs
- Woocommerce custom loop to show all the products [closed]
- Get the post permalink within the loop but without additional DB query
- Pagination 404 errors for author posts query on author.php
- Display revision if post status is pending
- How To Remove/hide some specific categories from two different categories widget from sidebar
- WP Query search for attachments and their exact title
- How to add another parameters to WP_Query?
- Display link to taxonomy archive only if it has posts with certain custom field values
- WP_Query compare with dynamic values
- WP Rest API max limit include parameter?
- How to display posts month by month?
- Programmatically set ‘meta_query’ for filter
- Display posts with date wordpress default
- WP Query Exclude and Start by Menu Order Offset
- Query total number of posts
- Category attribute not working in custom shortcode
- WP_Query Excluding pages with Order is 0
- How to display a posts 1 year ago with custom WP_Query loop?
- Check on which page specific result exist
- WC displaying products from category
- Show all post for a given category
- Loop returning only 1 result
- WP_Query create html structure
- How is WP_Query parsed to determine which template to request?
- pagination with numbers for WP_User_Query
- How does one perform a sub query with different post types
- Stuck in the query loop
- Query Page Content From Theme Options?
- Filter wordpress post categories with jquery/ajax and pagination?
- Include current post into loop
- How to Create a Random List of Child Pages
- How to display the featured image for each post?
- How do I amend wp_query before it is run/executed?
- Post Thumbnail URL isn’t pulling into the background of div
- Is there a way to make this kind of loop shorter and nicer?
- WP Query ordering on a meta field for posts with a date in the future not ordering by datetime
- Merge 2 custom post type posts and taxonomy terms and sort ascending
- Pagination on template page for custom query redirecting to index.php
- how to get Nearby zipcode
- Exclude authors IDs from WP_Query
- Reload Query Loop When FacetWP Uncheck [closed]
- WP Query Compare cutting off last 2 dates
- Exec wp query in slow motion to avoid memory error?
- Slider won’t work with custom query
- wordpress udpate query not equal to
- How to generate feed for custom template
- WP_Query with one category in args shows other categories
- WP Query – filtering terms with regex
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Why does apply_filters behave different inside and outside a loop?
- Excluded category from loop
- Add content depending on page loaded
- Custom template for password protected page
- Having a variable based on $post_count increase when i move to the next page of results
- Post order by custom fields
- WP Query and multiple pages
- Elementor posts custom query based on tag [closed]
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- How do you do a meta query on an encrypted field?
- meta_query with meta values as serialize arrays
- Multiple WP_Query args combinations according to post type
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- in_the_loop() issue with custom query
- Pagination inside the blog page not working
- How to restrict add media library only to images of the same post family?
- Is my code correct?
- Wp Query sort order
- get_posts query caching?
- wp_query returns match with no criteria
- Adding additional taxonomies to wordpress taxonomy page
- why doesn’t this pre_get_posts code work?
- pre_get_posts with WP_Query to prevent posts from specific tags
- How can I modify standard search query to include also ACF custom fields values?
- Best way to Order Post in Home without a plugin
- Retrieving category pages from subcategory returns empty sets
- Loop through multiple custom fields with increasing number
- Different number of posts showing in development vs production server
- Order WP_Query results in order other than ASC or DESC
- More efficient query to display posts in same sub-category?
- Get post closest to today
- Get WP_Query query after execution?
- Pagination in custom query not working [duplicate]
- $query_args for loop to only get posts from “current category”?
- 294 Queries on Mainpage of WordPress
- Pagination on custom post type not working
- Refresh wp_query with no changes
- SQL query into to WP query
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- Search results stuck on page 1