I actually found a cool value for the orderby option in this case.
meta_value_datetime
It works the same as using strtotime and the date methods in PHP. So here is my final code that started working:
$wp_query=new WP_Query(array (
'post_type' => 'sermon',
'meta_key' => 'sermon_date',
'orderby' => 'meta_value_datetime',
'order' => 'DESC',
'posts_per_page' => -1
)
);
Related Posts:
- how to get list of all users and their metadata
- How to make a custom column on the Users admin screen sortable?
- wp_update_user doesn’t update and update_user_meta does
- remove user_meta data from database for all users
- How to get last login Access Date and time
- How to get user metadata for social media url?
- Admin user edit – Grab newly submitted user meta immediately after update/submit
- wp_get_current_user in custom file returns 0
- Is there a limit to the length/size of serialized data that can be stored as user meta?
- Customizing WP tables or adding new ones?
- Are the default entries for a user in wp_usermeta documented?
- update_user_meta adding new rows in db for same key
- What is the meta-box-order_post_hash used for?
- Allow role to edit users at lower level with only specific metadata
- User meta conventions / name registry, for social media links
- Get user’s ID on logout
- Sanitize textarea instead of input
- Multiple User-Meta Values in One User-Meta Key
- Getting $user_id for the_author_meta outside the loop in multisite
- Gravity Custom Merge Tags [closed]
- How to insert new element to existing array in usermeta?
- Update user meta through a front end form
- What is the difference between get_the_author_meta() and get_user_meta()?
- Can I prevent “wp_user_level” from getting added to wp_usermeta on registration?
- Get the Google+ and Twitter links – WordPress SEO plugin
- Showing all users who match 2 meta fields with current user
- Adding current user’s ID to the end of PDF hyperlinks in post content
- Send mail to user only once when specific check box is selected and updated from profile meta updated by admin
- add custom field in user register form
- Is it possible to read a result if wp_update_user or update_user_meta fails?
- User last login and user last visit problem
- Why get_users() not working on the admin backend?
- Can I set user meta for theoretical user 0?
- Is there a way to append meta data without creating a race condition?
- I want to update my user meta table
- Subscribers Group User meta delete
- get_user_meta returning empty when it’s NOT empty
- Multiple meta values for one meta key
- When is a user’s meta data table loaded?
- Display and Update User Custom Meta via user-edit.php
- WordPress REST API and User meta data
- How do I add a dropdown list of numbers 1 – 1000 as an extra profile field?
- Get user meta for only the keys with a certain prefix
- Serializing User Role for update_user_meta
- Get user_meta values for a user for an array of meta_keys?
- Fetch user related data
- Displaying field value in new column in users view on wordpress
- add_user_meta allows multiple clicks and inserts more than 1 value
- Add user meta fields on creating the user
- Update user meta without lose of old data
- How can I undo accidentally duplicated user metadata key values?
- How to add to a user_meta field (append)
- editing usermeta when field is an array
- How to order users by a date in the meta_value array
- How to order custom fields in the user profile (admin area)
- If logged in user views his profile page
- Should I have a single cron job that loops the users, or one for each user?
- Getting a users username in get_user_meta
- Updating user meta on save post
- Save editor’s value in user meta and retrieve it
- How to get its meta_value of a specific meta_key within wp_usermeta
- How do i put in user id in a banner
- Exclude specific user_id from args in get_comments
- How do I sort a WP_USER_QUERY by multiple meta fields?
- WP_Editor not saving data in user_meta
- Update user meta array using foreach
- Can’t get the user_meta correctly
- Display Country Flag in Profile WordPress/Buddypress
- get random users each time based on the meta key
- How $_GET[‘updated’] variable is passed when updating a user?
- How to get metadata (in my case mail) of users who have a certain set of metadata?
- user metadata in json format, update the data partly only
- check metadata in wordpress
- How can I return an error message when updating user meta?
- Adding user metadata to all users
- Get user count based on multiple meta key values?
- how to save multiple checkbox in usermeta and get it?
- Existing user_meta fields not updated
- get_the_author_meta i want to write in a loop
- How can I track who clicked what in my member area?
- How to gets users EMAIL by their USERNAME
- Get user meta on registration hook
- Storing data to database and user registration
- update_user_meta inside a popup/modal
- add_user_meta() vs update_user_meta()
- Get all data form users and users metakey
- How to get user meta value in wordpress
- How to display checkbox meta array values one by one?
- User biographical information erased on login
- Fetch User Meta Data
- How to toggle delete/update user meta values?
- If logged in user meta is
- WP Cron: Save third party data as user meta
- Reordering fields in registration form via custom plugin
- Multidimensional array problem with update_post_meta [duplicate]
- CRM and newsletter integration? [closed]
- Strip Twitter Username from Profile Field with URL and Save to New Profile Field
- Custom user meta values in shortcode
- Update another users meta
- Find matches of a variable in custom usermeta