Your second approach should in my mind actually work, you do it like this:
Code:
$args = array(
'post_type' => 'agenda',
'posts_per_page' => -1,
'meta_key' => 'datum_agenda',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
$my_query = new WP_Query( $args );
There are two pages at the ACF documentation you might want to read: Date Picker and Order posts by custom fields. Besides that the only thing that comes to mind would be how is the date formated and might the problem originate there, having yymmdd
as value for the ACF »Date Picker« field »Save format« is recommended.
Related Posts:
- Order RSS content by an advanced custom field value
- WP_Query – Order results by meta value
- Where are custom field values stored in the database
- ORDER BY custom field value
- Sort posts by custom field numeric value using dropdown
- How to position a custom field before the editor
- Retrieve custom fields on Categories, using WP-API
- 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
- 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
- Displaying Custom Fields on Post with Genesis Child Theme
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- ACF won’t load from a custom JSON location
- Sorting posts by custom fields in meta_query
- Show ACF fields only on certain page in the backend
- How can I pass a variable set by ACF to header.php?
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- 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?
- WP_User_Query pulling ACF to loop
- 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
- Advanced Custom Fields dynamic update_field
- Order Custom Post Type by Custom Field Value
- WooCommerce – Adding Custom Fields To Invoice
- Change order of posts
- Meta query with multiple custom fields for archives page ordering problem
- query posts custom field calculation value
- Vimeo thumbnails
- Walker class for sub-menu with ACF fields
- Using abs() with custom field in orderby statement
- How to list Category list in ACF Pro’s Select Field to choose from [closed]
- ORDER BY custom field value out of where clause
- Get all the posts where meta field with multiple choice has several values checked
- Querying posts by latitude and longitude to build a Google Maps with several markers
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- ul list with only as many li’s as filled custom fields
- Retrive Image URL of Custom Fields in Theme
- Let Users Filter Posts by Custom Fields
- Filter posts by custom field (Advanced Custom Fields)
- How can I output the custom fields wrapping with HTML
- Displaying an ACF list of users
- ACF Plugin How to make the customer add more fields in the post?
- Custom field Search with Relavanssi
- Order custom fields alphabetically
- How to get custom image field of specific post id
- Problem with writting correctly a query posts args in WordPress
- How to query posts by month based on date custom field?
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- How To Save Data From Remote APIs To ACF?
- comments_where Hook
- ACF field group not showing in page
- get_field values for each post on home page using wp_add_inline_style
- Problem with revisions only returning four results
- Is there any way to make a custom field for a post only if the author is a certain user?
- How to use ACF with javascript to update custom field values?
- Sort by an ACF field in a tax_query
- WordPress Admin – Automatically Sort Custom Posts by Custom Field Date Value in d-m-Y Fomat
- Weird custom fields data lost
- adding autosave feature to custom fields
- (woocommerce) How to get product id form order id & then retrieve custom meta linked to product?
- Getting user’s data, by custom field lookup (meta)
- ACF – Compare user and post data
- Counting number of images from loop
- How to add content with a filter when there’s no content in the editor
- Query Posts based on custom field value
- How to properly get popular Posts by multiple Values
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- display Flexible Fields from options
- Display Child Page with custom fields within Parent Page
- Display different category template if custom field is checked
- Order a query by meta_value and then by post_date
- How to filter post using custom feild value in shortest and longest duration?
- How to Order Posts by Custom Fields?
- Fetch data from a WP page with same name as current username
- Order by custom field in query multiple
- Get custom field from other post in carousel
- Advenced custom fields auto fill problem
- Adding custom field to an array
- Add image custom attribute [closed]
- Can’t sort custom column on user.php by number / meta_value_num?
- How to get all specific fields from one ACF Group?
- save all acf options in one meta_value [closed]
- acf field repeater link don’t work
- Best way for managing images of ads banners
- ACF in radio button cf7