I was having the exact same problem while querying post and pages, but also the jetpack-portfolio post type in my custom widgets.
I was using $query = new WP_Query( $query_args ); in both cases. For me the fix was to change $query to $query_entries and $query_projects. It works as expected now.
I see you’re already using $products, but maybe it conflicts with some other query you run. Try to change that and see if it does the trick.
UPDATE: Disregard that, it didn’t fix it. If I close the Customizer and come back to it, the widgets are still acting weird.
Related Posts:
- How to target the default Recent Posts and Recent Comments widgets with pre_get_posts?
- Pass the same object to multiple widgets in a template with one query
- How can i make WP_Query return post image and categories?
- Retrieving list of a custom post type in a widget without using WP_Query?
- How to detect if query is runned from widget?
- Most commented last 24h, week, month, year and all time – posts_where
- Show post number in widget loop
- Error with function in functions.php?
- How to create a widget like this?
- All Posts Have The Same Comments
- Widget only in first post
- How to add a recent post function to a text widget I created for practice?
- Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y
- How can I show only last year posts in wordpress archive?
- Adding a Theme Customizer Control for Posts_Per_Page
- wp_query – Modify $query to include duplicate content
- Wp_query to get woocomerce product categorys [closed]
- Shouldn’t I be able to modify the main query by this filter?
- Hide elements outside loop based on query
- WP Query crashes on more than ~ 2000 posts
- different for loop if screen resolution < 1000px
- insert value from html into data base with wordpress
- Debugging wp_query orderby for taxonomy
- Get all posts which was posted on X Days WordPress
- Pagination is not working with custom query inside a homepage template
- Issues with search after added meta_query
- How to load a script code only in posts?
- Display posts with specific value first in query
- wp_query comment and meta query
- Show menus to one admin username
- Woocommerce: order posts by meta key
- Modify query posts
- Get the child category ID of current category
- How do I add an item to the WP admin menu?
- Multiple meta query from array
- I need to run a AJAX Fuction from within a WP_Query but only works on first item
- Find only those galleries with images
- WQ Query post meta date comparison
- Category not being selected
- WP_Query with 4 post meta field arguments gives 500 internal server error
- Limit number of posts in WP_query per month
- Filter subpages in while loop from WP Query object
- How to filter a static post page with ajax and $wp_query
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- how to translate countries output from wp database?
- Custom query does not find pages
- WP Query Order By Multiple Values
- Error: Attempt to read property “ID” on null
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Unrelated post showing in WP_Query
- Custom meta_query order for Elementor based on post meta key [closed]
- wordpress pagination wont render on custom page template even though its right under the loop like the documentation says so
- How to combine meta_query and date_query with condition in WordPress
- What’s wrong with this meta query? (order by meta key, then title, doesn’t work)
- ElasticPress is (aparently) messing with my search filters
- get_posts function not returning any results
- show related articles in single.php template
- INNER JOIN custom tables – SQL Query
- SELECT TOP 1 in wp_query for each groupby meta value
- Get unique post by meta value using wp_query
- How to query search only for post titles?
- Shortcode attributes causes 500 error after updating the page
- WP Query. Ordering posts by another post types meta
- How to display author meta and count numbers for each user in comment.php?
- update_post_meta() not updating
- XMLRPC pingback.extensions.getPingbacks not work with parameters
- WP_Query to Retrieve Posts from WooCommerce Products that are Only in Catalog
- Get top 5 posts viewed using post_views_count
- Get posts meta_query by repater field
- WordPress pagination not returning posts on second page
- Search Filter With Custom Taxonomy and Custom Fields : How do I handle it via plugin?
- query_posts based on a meta_key
- Track write actions to the database
- How can I use two custom fields in WP Query
- How can I use a specific wordpress page template if certain words are used in page title [closed]
- Query with two posttypes and two different meta_keys
- Sort by meta key within same day
- Duplicates When using Nested WP_Query
- meta_query not working with the_content()
- how to exclude store in clipper theme wordpress code php
- Show portfolio items in template – how?
- Display post list within category list sorted by name [duplicate]
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Extract video content from post to display on front page
- Display First posts without the default featured image
- Hierarchical List Pages as a table
- WP_Query with several meta_query-statements and order by meta_value
- query_posts, oderby meta_value & print “future” posts
- Second wp_query doesn’t appear to be working
- difference between methods of query
- Query posts by meta value and sort by another meta key
- post__in not recognizing multiple IDs
- Related posts with WP_Query
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- How do I split a large query with a semi-expensive function included into multiple smaller queries
- Custom WP_query in Jnews theme returns thousands of posts
- wp_query loop with compare operator simply not working, why?
- How to replecate the _fields parameter in custom REST api endpoint
- How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?
- WordPress WP_Query custom order_by post_type functionality