I had to do this on a program management system. this should do the trick.
add_filter( 'pre_get_posts', 'my_sort_posts_listing' );
function my_sort_posts_listing( $wp_query ) {
if ( is_admin() && $wp_query->get( 'post_type' ) == 'my_post_type' ) {
$wp_query->set( 'meta_key', '_my_date_meta' );
$wp_query->set( 'orderby', 'meta_value' );
$wp_query->set( 'order', 'DESC' );
}
return $wp_query;
}
assuming your dates are stored like YYY-MM-DD
Related Posts:
- How to display value of custom fields in page
- Custom post type single-{custom}.php not working
- Mini-Site Strategy
- Custom Post Type Permalink Page Not Found
- How can I fix those issues generated by the Themecheck plugin
- Why is get_post_format() for “Standard” returns empty
- Is it proper to create a page just to generate a listing page (eg. for a custom post type)
- Custom Post Type Archive URL takes over page URL
- Where to put archive-{post-type}.php
- Password-protect a custom rss feed
- How to set a custom post type post as static front page?
- Custom post type archive sorted and grouped by date in post meta field
- Assigning Multiple Layout Designs with Custom Pages in WordPress?
- How to retrieve custom field types for all posts in WordPress/PHP?
- adding .current* tags to custom post types and taxonomies
- Integrating Orbit slider into wordpress through custom post type
- Page as a child of a Custom Post Type
- Generate Shortcodes by Taxonomy
- Why is archive.php used for my page
- ACF simple text field value not showing
- Made Custom Post Types, but single.php not working
- What’s the difference between same wp functions get_posts(); functions in different form?
- Help need making decision. Ads rotating site on wordpress
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Return the latest post from a custom Taxonomy and Post Type
- Don’t know how to show custom taxonomies from a custom post_type
- JS innerhtml changing style when using AJAX
- Display a grid of taxonomy terms at root taxonomy page
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- Event Custom Post Type Title show by upcoming Event Dates
- How to have this permalink structure: post_type/postname/custom_inner_page
- Custom post types and category archive
- custom comments form for custom post type
- Warning: Invalid argument supplied for foreach() [closed]
- Custom post type isn’t working
- Warning: Invalid argument supplied for foreach() in post.php [closed]
- Getting Un Wanted Gallery Shortcode In The Page on Loop
- detect your custom post type in WordPress
- Custom WP_Query doesn’t display all posts
- WordPress app page not found error for posts with hyphen in permalink
- Create a comments template for custom post types
- Show Taxonomies with admin area for custom post type?
- Pagination doesnt work in custom post type
- Archive links for custom post types
- Include custom post type custom taxonomies in Categories widget
- Template Hierarchy for custom post type pages
- Should Custom post types and fields be in the theme files or in a custom plugin packed into the theme?
- Custom Post type content within a slider
- Methods for development wordpress themes [closed]
- Searching post types
- Custom Post Type – Main page for certain posts
- How to exclude categories from a sidebar with active widgets in it?
- How does one go about converting custom post type to post format?
- How to display magic field’s custom write panel in wordpress theme?
- WordPress giving me the index
- Not Able to Add New Class To CPT Attachment Image
- Custom post category name showing empty
- How to store the third party script with HTML code in the wordpress custom input field?
- Getting Same Description in All the Custom Taxonomy Posts
- Get next and prev item from custom WP_Query and Custom Post Type
- Post type to appear on every page on site
- Error 404 change permalink term custom term taxonomy
- How to display custom field in product description?
- Manually adding current_page_parent to wp_list_pages()
- I have a random letter appearing before my content. Where to start looking for the cause?
- Add extra elements to the_post in a custom post_type
- Visualize info in just custom post_type in theme
- cpt not display inside nav menu
- Issue on Getting URL of Uploaded Image to a Custom Post Type
- Custom Post Type has wrong label and is not found when called by a loop
- Custom post type single page uses the right template in preview mode but shows a different template after being posted
- Custom Post Type archive page listing a 404 or single post
- Too many revision when post status is changes [duplicate]
- Having issue on Loading Meta Data From CSV to CPT
- Front End users account with lots of user Roles (not Woocommerce)
- Values show up in custom home page but not in custom post pages
- Permanent Custom Post Type
- Custom post type that lets users create a set of posts?
- creating a custom post template
- 2 custom posts types, in their own columns, one pagination for both
- wordpress query_posts with foundation 6 Accordion not working correctly
- Creating Slider in wordpress theme with custom post
- Help with Multi Level Category Archive Page
- How to develop custom URL redirection
- Loop carousel slider in wordpress
- Custom post type with custom taxonomy permalinks
- Custom taxonomy page template
- get_pages can’t load pages with custom post types
- erase post excerpt limitation [×]
- Add “post option” support parameter in custom post type using Hueman Theme?
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Having some trouble properly displaying Custom Post Types in templates
- Displaying information from Custom Fields in template with Types?
- How to Create Custom Post Type with Multiple Color Options?
- How to manage wordpress knowledge base/wiki/posts collections
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- Retrieve a post with its ACF repeater fields in wordpress
- WordPress search results grouped by post type
- REQUIRED: The theme uses the register_post_type() function, which is plugin-territory
- Default WordPress Query for a Specific Custom Post Type URL