hope this code will helpful for you
$args = array(
'post_type' =>'event',
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_key' => 'event_date',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
Related Posts:
- Order Custom post type loop by custom field (datepicker)
- Alter main archive, to show posts with meta as last
- How to query posts by month based on date custom field?
- Problem with revisions only returning four results
- I want to add a custom field in the rss title of each post, but don’t want it to be shown on the site
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- WP_Query – Order results by meta value
- Where are custom field values stored in the database
- ORDER BY custom field value
- Advanced Custom Fields – Get custom fields from parent page
- Add custom field to the archive page?
- How to rename a custom field?
- Matching Serialized Arrays with meta_query
- How can I make wp-pagenavi work on a custom query built upon a form submission? [closed]
- Meta Query with AND & OR?
- Sort posts by custom field numeric value using dropdown
- How to position a custom field before the editor
- Display post_object content using Advanced Custom Fields plugin
- Remove old custom field after import
- Unable to get Preview of Uploaded image within a Custom Meta box
- Retrieve custom fields on Categories, using WP-API
- Trying to perform complex custom field query with order by set to field value
- Order Posts by Closest Numeric Values
- Is there a way to do multiple ordering on a multiple meta_query?
- Order by custom field date?
- Order by custom field date with ASC order
- Change content before writing to database
- Revolution Slider Orderby Two Custom Fields
- Sorting within nested queries / multiple meta keys
- Ordering posts by anniversary using only day and month
- Order by Custom Field date not recognized
- Comments form custom fields order
- If value present, order posts by two consecutive custom fields
- Using Custom Function With Advanced Custom Fields
- automatically set “Featured Image” the same as the og:i that is set in a custom field
- Problem with adding exta field in metabox in custom post type
- Copying Custom Meta Values from existing post to a duplicate post
- Calculate the sum of certain the_sub_fields
- can’t get query to order posts by acf datepicker
- Displaying Custom Fields on Post with Genesis Child Theme
- Change the RSS Publication Date to use a value from a custom field
- Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields
- Plugin similar to Taxonomy Drill-Down for custom fields?
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Login & Register & Custom details WITHOUT plugin
- Sorting posts by multiple values, combined
- Send Multiple Custom Field Values Through the URL
- ACF won’t load from a custom JSON location
- How do I query for a post by custom field?
- Sorting posts by custom fields in meta_query
- Count how many posts have a custom field set
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Show ACF fields only on certain page in the backend
- Update posts after populating ACF field value [closed]
- How can I pass a variable set by ACF to header.php?
- sort search results by custom fields using dropdown
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Transfer self made functions.php custom fields to Advanced Custom Fields [closed]
- How can I sort homepage by a meta value?
- Loop to display random posts only if a custom field matches category
- Conditional custom field query
- ACF: How to get the full field name (meta_key) by a field key?
- Dynamically fill a post custom field with post publish date
- How can I store a file in the database in the same way WordPress and ACF do?
- Will loading too many ACF Fields cause slow down?
- Display only past events on that page using Visual Composer Grid Bulider
- Custom Field Create Bulk via SQL Query
- Create Pop-Up Box with Custom Field Content Inside the Loop
- WP_User_Query pulling ACF to loop
- query usermeta from custom field
- Is there any way to get all meta and standard columns for any WordPress object after searching based on meta key and value
- Calling the “wp-link-wrap” pop-up modal
- Print custom field in Query Loop block
- Order posts by custom field DATE value
- How to add Advenced Custom Fields In Single Post
- How to schedule a custom field value update?
- Add new image block, set default class name and update it using Javascript
- Get an advanced custom field after post publish
- How to create a dropdown select of all items in an ACF field group
- Advanced Custom Fields dynamic update_field
- Order by empty custom field
- Order Custom Post Type by Custom Field Value
- WooCommerce – Adding Custom Fields To Invoice
- Sort custom post type by multiple custom fields
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Change order of posts
- Trying to reorder posts by custom field
- Limits, not all post are showen when querying for posts by view count
- Meta query with multiple custom fields for archives page ordering problem
- Why orderbyb meta_value_num won’t affect the generated SQL Query order?
- How to query categories with Advanced Custom Fields?
- Ordering posts by custom field named “date” in backend
- query posts custom field calculation value
- WP Query – Is this correct?
- Vimeo thumbnails
- Get post ids sorted by meta_key
- Advanced Custom Fields WYSIWYG More tag
- querying a custom field
- How can I modify RSS item titles to be either the title or a custom meta field?
- Walker class for sub-menu with ACF fields