- A
meta_query
has to be an array of arrays. You only have an array. - A filter needs to
return
information. Yours doesn’t. - Of course,
parse_query
is an action not a filter, despite your use ofadd_filter
. Useadd_action
instead. - I would use
pre_get_posts
instead ofparse_query
. It is the next
hook that fires afterparse_query
(check the source) and your code works more or less as expected if you use that hook, assuming the change mentioned in item #1.
Related Posts:
- meta_query ‘compare’ => ‘IN’ not working
- How to query posts based on lat-lng coordinate as post meta?
- Set Alias for meta_query arguments in get_posts()
- Sorting: custom query with orderby meta_value_num THEN by title
- Add indexing to meta_value in wp_postmeta
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Custom WP_Query order by post_meta and (author) user_meta
- Using custom meta_query with relation not working as expected
- Perform query with meta_value date
- How to grab metabox value in wp_query meta_query key
- WP_Query meta_query where meta value ends in space
- Nested query inside Logical operator OR not working in meta_query
- What is an efficient way to query based on post_meta?
- datetime picker, timestamps and meta queries
- How do I create my own nested meta_query using posts_where / posts_join?
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Compare two meta-fields in a wp_query (where meta-field-A is larger than meta-field-B)
- How can I create a WP_Query that returns posts where one meta_value
- Meta Query querrying several post types based on ACF fields is broken after update to WP 4.1
- Exclude post on loop by multiple meta key value
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- meta_key and meta_value not working together
- Order posts by meta value and Date
- Query sticky posts with thumbnails
- Order WP Query posts by custom order calculated from post meta values
- how to speed up a complex wp_query?
- Meta query with order by another custom field
- How to query for custom field within Gutenberg block from outside of that post? [closed]
- Meta Query for specific months
- Meta query with JSON value
- Get meta info related to current post
- Creating arguments from loop for WP_Query meta_query
- wp_query not searching with apostrophe
- Add condition of user capability in WP_query
- ACF Date Based wp_query
- Custom query based on meta key – Reduce three states to two in results?
- How to make Meta Query case sensitive?
- Get attachment by meta_key value
- Any number in meta key (wp query)
- Using meta_query with multiple keys and compare values
- Mysql query and order meta value
- How to display multiple custom fields with the same meta_key in an ascending order?
- Meta_query with multiple keys and multiple values
- Is it a good idea to improve meta query performance by adding tax query?
- meta_query BETWEEN, but the range is stored in the custom field
- Is it possible to set specific posts to show first in a query?
- Modify wp-query and sort by post meta key
- Orderby listing issue
- Order ascending is ignored in meta query?
- database query with more than a couple meta hangs and doesn’t complete
- Make meta query treat meta_value as 1 or 0
- WP Query Meta Value – How To Identify Specific, Unique Values?
- Order by meta_key doesn’t work
- Sort by presence of thumbnail
- it’s possible make a WP_Query with math operations?
- Multiple meta_key ordering with pre_get_posts
- Sorting search results with custom dropdown
- Error in meta_query not get result
- Meta query with compare by more than 2 fields
- How to get current page nearest parent id?
- WP_Query meta compare must include ALL array values
- meta_query returning excluded result
- What’s missing in this wp_query and meta_query
- meta_query weird behaviour, static int will work, but not user data
- Creating a query that get all posts but places meta items first
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- get_posts query is taking about 40 seconds to execute
- wp query to use both author id and meta_query
- meta_query – check for multiple meta values in key which holds an array of values
- WP_Query for a taxonomy value OR a custom post type meta field
- Trouble with serialized metadata
- meta_query order by date present -> future then show null
- Meta query orderby meta_value_num sorting by role first
- Get posts having meta value between two numbers
- meta_query compare > not working
- meta_query is not allowing to show posts when querying multiple arguments in a WP_Query
- Speed up WP_query with meta comparing dates
- Meta Query if Values Don’t Exist
- Saving custom fields for WP_Query to retrieve
- How to show all the associated posts with specific date of data metabox?
- Is it possible to search for a string in posts OR postmeta?
- Filter posts/pages by user_role array
- WP_Query with MetaQuery issue
- WP_Query Posts by Metadata from Option Tree
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Using orderby with 2 meta keys
- WP_Query with meta_value_num and meta_query not paged correctly
- Post Query not working after updating to 4.1
- Orderby Meta Value and Query from Meta Query
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- Sort Posts with custom meta key by default which is currently set as optional
- Why is WP_Query’s meta_query not filtering results?
- WP_Query with several meta_query-statements and order by meta_value
- meta_query in wp_query not working as expected
- How do I have multiple metaqueries inside one wordpress query
- WP query with multiple custom meta not respecting orderby
- Display only posts with thumbnails