Custom meta boxes store values in the same way as custom fields, they just have a prettier UI.
You shouldn’t need to modify your query in anyway other than knowing the key
under which the custom meta box stores it’s values. If you’re using a plugin to generate the custom meta box, you’ll have to dig into its internals to find the meta key. Most custom meta boxes “hide” the keys from showing up in the custom fields UI by starting them with an underscore (_
).
<?php
$the_query = new WP_Query( array (
'showposts' => 10,
'post_type' => 'page',
'meta_query'=> array(
array(
'key' => 'start_date', // this key will change!
'compare' => '<=',
'value' => $today,
'type' => 'DATE',
)
),
'meta_key' => 'start_date',
'orderby' => 'meta_value',
'order' => 'DESC'
) );
Related Posts:
- meta_query with meta values as serialize arrays
- WP_Query with checkbox meta_query
- How do I add an item to the WP admin menu?
- meta_query with meta values as serialize arrays
- Query by meta value (add a dropdown of all values)
- Saving custom fields for WP_Query to retrieve
- How to show all the associated posts with specific date of data metabox?
- Meta_query compare operator explanation
- Nested meta_query with multiple relation keys
- meta_query ‘compare’ => ‘IN’ not working
- Sorting: custom query with orderby meta_value_num THEN by title
- ACF Relationship Field Search Filtering [closed]
- Query Multiple Post types each with own meta query
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Meta Query with date and time on the same Day before given time
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- WP Meta Query for some meta (array) values
- Sort users by meta_value_num
- meta_query with array as value
- Using WP Query to search within ALL keys in meta query
- WP Query – Get WooCommerce Products with variation that is in stock
- Meta_query with or without value
- Meta-value query
- Meta query field order together with post_date order causes posts without the meta field to be unordered
- pre_get_posts filter meta_query without conflicting existing meta_query
- Undefined property: WP_Query::$post
- Programmatically set ‘meta_query’ for filter
- WP_Query meta_query >= date
- wp_query not searching with apostrophe
- Extending woocommerce admin product search
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- Custom query based on meta key – Reduce three states to two in results?
- Performance when getting post meta for post retrieved by meta value
- Adding an array from a query string to a WP meta_query
- Query multiple meta values
- Query by multiple meta elements not seeming to work – wordpress is timing out
- How to display multiple custom fields with the same meta_key in an ascending order?
- Meta_query with multiple keys and multiple values
- How does one perform a sub query with different post types
- Tax query AND/OR meta query [duplicate]
- Help ordering Post loop by two meta values
- New WP_Query loop in admin causes problems
- meta_compare not comparing whole integer
- WP Query ordering on a meta field for posts with a date in the future not ordering by datetime
- Is this meta query problematic?
- Selecting posts with a given meta value for a meta key
- Appending to existing WP_Query’s meta_query if exists
- Get every post with value in meta key
- get_page meta query not working, maybe a bug?
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Custom query filter by ACF date custom field
- Query by date from custom field
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Nested array issue in meta_query
- Error in meta_query not get result
- WP_Meta_Query object with conditionals
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- How to get current page nearest parent id?
- meta_query with array as value with multiple arrays
- Why doesn’t my WP Meta Query return any results?
- Help with if statement inside while loop
- wp list pages using meta box value
- Sort posts using multiple custom fields and menu_order in single query?
- Order (by ASC) posts with meta_key so posts without values are last
- Search filter between promo and exact price
- meta_query – check for multiple meta values in key which holds an array of values
- WordPress Meta Query Null Values Order
- show most viewed post
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Why can my filter query SOME metadata but not other metadata?
- Getting posts by custom field value
- WP_Query on custom key and value
- Get posts having meta value between two numbers
- wordpress multiple meta value query is not working
- Strange results from WP_Query
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- Pre get posts sort by meta key returns no results if meta key does not exist
- Sorting with meta_query and multiple, optional meta keys
- meta_query with relation = AND not working as expected when combining EQUALS with NOT EQUALS
- WP Query for Multiple Post Types
- Order Posts By Custom Field That is an array of objects
- Orderby query does not work for custom fields even with meta query
- make query more simplest and in one query
- WP_Query returns empty if meta_query has more than 7 values
- Use not custom fields in get_posts() meta_query?
- Compare meta key separation
- WordPress meta_query not working
- Using orderby with 2 meta keys
- Query to get all the posts of more than 2 meta_value having same meta_key?
- Passing conditional arrays to WP_Query() [closed]
- WordPress Query Default Order if Meta Values Same?
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Wp query by 2 meta field – check if they exists / have value
- Get all user with both meta_value
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Use meta query only 3 or more results?
- Use value from meta key array for use in WP_Query
- WordPress – Optimize the Meta Query for 3 meta keys at a time