It’s because you are checking 'event_date' == $vars['event_date'] not 'event_date' == $vars['orderby].
But don’t use the request filter. Instead:
add_action( 'pre_get_posts', 'event_column_orderby' );
function event_column_orderby( $query ) {
if( ! is_admin() )
return;
$orderby = $query->get( 'orderby');
if( 'event_date' == $orderby ) {
$query->set('meta_key','_wr_event_date');
$query->set('orderby','meta_value_num');
}
}
… and don’t manually set the order as you won’t then see the difference when toggling between ASC/DESC.
Related Posts:
- How do I set the default admin sort order for a custom post type to a custom column?
- Make custom column sortable
- Column sorting with emtpy meta values
- How do I sort a custom post type admin column using two meta keys?
- WooCommerce sort products by the actual product width(not the shipping width)
- Sort and filter custom post type posts by custom taxonomy
- Order a custom post type admin screen by a second custom post type title
- Make a custom column sortable by a value from a different custom post type
- Sorting custom post types in edit.php : Post disappear
- Remove filter and view options from custom post type edit screen
- custom filtering admin columns
- How to use multiple orderby conditions on query search results? (orderby one post type, relevance)
- Grouping and paging CPT events by month with custom field date
- Make custom post type column sortable
- Versioned Custom Post Type (Not the same as revisions)
- WordPress posts page for customer filtering and sorting along with category filter
- manage_edit-{post_type}_sortable_columns sorts, but wrong!
- Loop filtering Custom Post Types and/or Categories
- search suggest – filter post type
- Sort entries by date mixing two post types
- the_content filter on some post types only not working
- Filtering posts list table
- Custom filter function not working with Custom post type
- Filter Posts from the Main Query
- Categories filtering in new post
- WordPress make Grandparent and great grandparent filterable in custom columns
- How to use manage_$post_type_posts_columns with underscore in post type?
- How does the filter post_updated_messages work?
- Search filter triggered & sort by custom post type
- How to order posts of a custom post type by date DESC in dashboard Admin?
- How to sort posts in a custom post type by title in ascending order by default?
- How can I add a filter to a particular post format?
- Is there any way to get list of all possible filter hooks for all post types?
- Can I display custom post types in home.php or need page template?
- Create new custom post and post category of same name
- 4 column-loop ordered alphabetically with entries grouped (and labeled) by their first letter
- wordpress remove views from action links in a custom post
- sort post types by amount of views
- Custom post type sorting: alphabetical order
- wp_insert_post wrong post type [closed]
- Sort a custom post with ACF: Date Picker & Display Featured!
- Custom columns doesn’t appear in custom post type
- How can I use this code on a custom database table?
- Filter posts by tax (dropdown) and meta value
- Sortable column containing numeric values for Custom Post Type at WordPress Backend
- Problem with $post_id object’s property
- Pods CMS: How to add custom column to Adnvanced Content Type
- How can I remove filters from custom post types?
- CPT Columns doesn’t show categories
- sortable columns for multiple custom post types not working
- I need to add a filter to prepend the term ‘National – ‘ to the post title if the post is tagged to multiple states
- Custom Post Type page sorts differently on different environments
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- REST filters only firing when I have a param set
- Getting post attchment URL to populate a CPT Admin Page Column
- Sort custom post type by most current date picker
- Problem with Apply Filters on URL in meta box filed of custom port type
- Creating a “glossary” of WordPress posts of a specific post type
- how to retain the ability to modify the post slug after applying a post_type_link filter?
- Custom Columns for Custom Post Type Manager
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- How to filter url on post submission?
- Sort results without WP_QUERY?
- Modifying WP_Title For Custom Post Type
- Filtering the_content, but still need to display the unfiltered content inside filter
- sort by name (slug) custom post type
- Change Custom Post Type singular_name through function/filter
- Modify a plugin function output from another plugin
- Sort column on meta key and meta value
- Custom Taxonomy Filter Issues
- Catch and display error on save_post action
- show most viewed posts of last days by link?
- Custom loop request based on custom field
- Filter search posts by post meta?
- Modifying search results based on post_type
- Custom sortable column with WPAlchemy
- What’s an easy way of sorting custom post types manually?
- How can I sort the order of multiple custom field values in a custom post type?
- Sorting the Loop by Taxonomy Value
- Is possible register two archive pages for single custom post type?
- Sortable column with custom data by date
- Add Content Column to Custom Post Type backend
- Display custom post front end filter by ACF equals current user
- Hide Published text from custom post types column
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- conditional filter
- Ajax Post Filter | Split Taxonomy Into minPrice & maxPrice
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Query filter by value in meta_value array
- Best way to fix bad count on All | Mine | Published
- Sort custom posts by date and then by taxonomy
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Custom post type sortable columns when column value is from a custom database value
- Is there any filter to add a custom attribute to the tag in admin panel?
- Display category filters for custom post type when category is shared by multiple post types
- Store a value in global scope after init hook is fired
- Filter in Custom post type to find the parent post
- Custom sorting in post columns by ACF Pro Select Field
- Dynamic page for nav items used as filters