I prefer to use WP_Query (for more info read “When should you use WP_Query vs query_posts() vs get_posts()?“), try this way:
$args = array(
'post_type' => 'soiree',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date_de_concert',
// you don't need 'meta_key' => 'date_de_concert' when using meta_query
//'meta_key' => 'date_de_concert',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'date_de_concert',
'value' => strtotime( 'today' ),
'compare' => '<'
)
)
);
$concert_query = new WP_Query( $args );
if ( $concert_query->have_posts() ) : while ( $concert_query->have_posts() ) : $concert_query->the_post();
Related Posts:
- Using meta_query, how can i filter by a custom field and order by another one?
- order by meta_value serialized array
- Orderby if between two meta fields
- what is the correct way to compare dates in a WP query_posts meta_query
- Return all custom meta data for one custom post type
- meta_query for keys that aren’t yet set
- Fail to compare dates in meta_query
- How to filter custom posts by tags and custom fields?
- Order by & include array by specific post ids
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- Ordering posts having multiple post-meta date fields
- Querying custom post type with 2 custom fields (date-range)
- Display Custom Post Type Fields
- How Can I save multiple records in same meta key?
- Order Posts by Taxonomy and Meta Value
- How to hook get_terms() to only show count of posts that have custom meta
- List upcoming events, ordered by date in a custom field
- Using Query Posts With Multiple Post Types And A Taxonomy
- ascending order custom post type
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- query order by date on custom type: wrong order
- Used with meta_query in query_posts works slowly
- How loop through posts based on custom fields
- Filtering by Post Meta Custom Fields – Performance
- How to insert content from another Custom Post type into Post?
- meta_query compare >= not working but
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Rewrite and custom post type: order by custom field not working
- wp_query check if integer exists in custom field’s array
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Get posts between custom dates
- How to do WP_Query with two meta fields with orderby clause
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Order Custom Post Type by Custom Field Value
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- Ordering custom post type by multiple custom fields
- How to Output which matched meta_keys were found from custom_type_posts?
- Possible to filter custom post type with multiple meta data?
- Change order of posts
- filter search custom field query
- How to let users choose where to search for posts?
- Query based on custom fields start and end date
- WP Query – Is this correct?
- Add a custom meta box for client to order CPT posts how they want
- Getting a custom post’s custom field based on another custom post’s custom field select
- Querying multiple values from a single key
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- find custom post type post by searching its custom field with my string
- WP_Query of custom post type sorted by meta_key has unexpected results
- Custom Query: If One Post Object Field Value Is The Same As Another
- Best way to create a search for custom post type by custom field values
- Incorrect ordering of custom post type based on time
- Filtered by a custom field, ordered by another
- Display Posts Query with IF function
- WP query_posts group by meta field related
- order the meta query results by 2 custom fields
- Using OR relation in meta_query to check for a value before sorting by another
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Meta query and compare “!=” not working as expected
- Use WP_query to match post types based on custom field values
- Show posts from WP Custom Post Type selected from a field in a metabox
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- Meta_Query refuses to return results
- Sort loop by custom field from different post type
- Meta_query by date for Events archive
- What’s the most efficient way to get two queries based on an if statement?
- Query events post type after current date and timezone
- Show first posts with custom field not empty and order all by title
- shortcode order for event custom post type
- How to display custom post type ordered by a custom field date
- Selecting posts older than the current Unix epoch timestamp
- Unable to get the upcoming events for custom post
- Filter RSS feed for custom post type to events for next 7 days only
- Order Custom Posts by Several Fields
- Query Distinct Taxonomies of Custom Post Type
- Custom Query With Multiple Meta Key Value
- Ordering custom post type by custom field without a title
- 404 on Pages for Custom Post Type & Query_Posts
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- loop through custom post-type with two meta_keys
- Querying meta values within an array
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Get Posts ordered by a date custom meta field
- Check for custom field value in different post type than current one and do something
- Order Wp Query by earliest of 3 dates meta query
- Function to Compare CPT Post Custom Value with Default Posts CF Value
- Display ACF object field data using Elementor Custom Query
- Query Custom posts of same taxonomy as the post itself
- Query custom post type and custom field by URL parameters