I change it to get_posts()
instead of new WP_Query
and it works just fine. No idea what’s the problem with the query.
Related Posts:
- How can I create a meta_query with an array as meta_field?
- How can I query all users who registered today?
- WordPress creating excessive joins on meta_query with search
- How to display liked posts of current user in wordpress?
- How can I apply a meta query for a single custom post type in the main query?
- How do I find if a page has a template?
- How to check current user in meta value array in WP_Query meta_query
- Query metas (and not : query posts by metas)
- How to orderby multiple meta fields with another meta query
- Query returning same results even though the ID changes
- Order by meta value pro first then meta value free in my search function
- get_users with array as meta_value
- get_post_meta with WP_query
- WordPress Mysql query and Duplicate
- How to “orderby” the first array in a meta_query that uses multiply keys?
- WordPress query: merge meta key (number) values and sort
- Restrict WordPress search to a single ACF field
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Fastest and most efficient SQL query to check if UID exists
- Query Posts that have or don’t have a meta_value and order by the same ASC
- What is the best way to query posts based on live data?
- list or get meta_key where meta_value is ‘something’
- WP_Query orderby meta key/value suddely stopped working
- Meta Query compare with LIKE pulls similar post types: 55 and 155, and 1,155
- Query multiple meta key values?
- Is there a way of increasing the speed of this query?
- Reversing the order of posts AFTER the query is performed
- what are the numbers between curly brackets in search query
- When/why does ‘$query->get( ‘tax_query’ );’ return empty?
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Meta Query with AND & OR?
- How to get link and title of next and previous post on single page
- Search custom post type by meta data
- Multipart/formatted MySQL query problem
- Remove [gallery] shortcode altogether
- query multiple taxonomy and show post count
- Categories and products in random order
- add_query_arg() XSS Vulnerability
- Comparing timestamps in meta query doesn’t work
- Change searched term
- Query Posts By Post Publish Date, but sort by Custom Meta Key
- MySQL variable in query
- How to execute a SQL-query which contains multiple queries using $wpdb->query?
- Only show upcoming event or current events
- Why a URL with a query is always slower than that without a query?
- Maintaining Queries in URL
- How do I see the mysql query generated by get_posts( $args )?
- Query posts using meta_key
- Meta Query relation “AND” then set array accordingly
- Modify users.php query with multiple taxonomies
- MySql Query very slow
- wpdb query problem to access previous 3 days posts
- How to change the amount of posts previewed on a page?
- How to get events using multiple custom meta fields?
- Custom Query: If One Post Object Field Value Is The Same As Another
- How to hide posts of a specific custom category in WordPress?
- Random Page Rewrite
- How to pull posts into two columns with different image sizes using $counter variable?
- Select column name dynamically mySQL Query
- Combining two meta_values within one row with query
- Query multiple post types, but different order for each
- I want to get on those users their meta value are like “AGENT” .. but this query is not working
- Add rewrite rule for archive search
- How to create a filter and add query params to all links
- Get 2 meta values from meta key column
- WordPress add_query_arg from ajax and make url friendly
- Query against multiple locations within single custom post type post
- My custom pagination not displaying
- Wpdb->last_query returns bad query
- Attachment page tag queries & posts not found
- WP search exclude last letter from string
- Are there any best practices for creating a Like/Favourite feature in WordPress using custom MySQL tables and without any plugins?
- Not getting input from get_query_var
- Query reversed when I use “category__not_in”
- How to reduce the load / no of queries on MySql Database
- $query->set( ‘post_type’, ‘post’ ); not working
- How i make a custom sql query for Woocommerce
- Display result from custom post meta query
- Show certain number of post from tags
- Wpdb empty result only if language is Russian
- Include custom table in query
- How to fix this insert? Don’t work for me!
- Why the pre_get_posts hook can cause apache stopped working?
- Display Upload Author & Get Uploaded Post ID
- Display list of most recent grandchild (third tier) pages
- How can I display a number to represent the order of post?
- How to display a specific category using a custom Query in WordPress?
- Update vs Insert logic but the last key is always inserted?
- Sort order in get_posts [closed]
- Query unique author ids with published post of type job
- Wpdb generates too many queries
- Custom Query for searching through custom fields
- Query posts alphabetically within this function
- Conditional Tag Custom Querys?
- WP_User_Query. Whats wrong with ‘relation’ => ‘OR’
- query posts only works on the first page
- Custom Query for wp_posts using wp_postmeta
- WP Query outputs three items within a div
- ‘Active lotteries’ only custom query for woocommerce lottery plugin and elementor
- How to show sticky posts on all pages of the pagination, not just the first page?