2016-07-14: Post updated to support both pages and posts without redundant/useless code
Paste the following in the functions.php
file of your theme:
// Register the column for modified date function bf_post_modified_column_register( $columns ) { $columns['post_modified'] = __( 'Modified Date', 'mytextdomain' ); return $columns; } add_filter( 'manage_edit-post_columns', 'bf_post_modified_column_register' ); add_filter( 'manage_edit-page_columns', 'bf_post_modified_column_register' ); // Display the modified date column content function bf_post_modified_column_display( $column_name, $post_id ) { if ( 'post_modified' != $column_name ){ return; } $post_modified = get_post_field('post_modified', $post_id); if ( !$post_modified ){ $post_modified = '' . __( 'undefined', 'mytextdomain' ) . ''; } echo $post_modified; } add_action( 'manage_posts_custom_column', 'bf_post_modified_column_display', 10, 2 ); add_action( 'manage_pages_custom_column', 'bf_post_modified_column_display', 10, 2 ); // Register the modified date column as sortable function bf_post_modified_column_register_sortable( $columns ) { $columns['post_modified'] = 'post_modified'; return $columns; } add_filter( 'manage_edit-post_sortable_columns', 'bf_post_modified_column_register_sortable' ); add_filter( 'manage_edit-page_sortable_columns', 'bf_post_modified_column_register_sortable' );
When you refresh http://<Your Domain>/wp-admin/edit.php
or http://<Your Domain>/wp-admin/edit.php?post_type=page
the ‘Modified Date’ column will be visible and sortable.
This post is also available in: Greek
Based on https://gist.githubusercontent.com/scribu/906872/raw/2e08920818d2c038d105feae103c09f81cb205a3/gistfile1.php
How does this work for pages instead of posts?
I installed this using the “My Custom Functions” plugin and it added the column in “Posts” edit but not in “Pages” edit where I need it as well.
Pingback: Order by modified date working in POSTS but not PAGES * Best Wordpress Themes - Reviews
I got it working:
http://wordpress.stackexchange.com/questions/205506/order-by-modified-date-working-in-posts-but-not-pages/205507?noredirect=1#comment298125_205507
Pingback: Order by modified date working in POSTS but not PAGES | Asking
Pingback: Shutterstock Customer Service - Customer Care Free