Sortable Last Modified Column
Adds a sortable "Last Modified" column to the Posts and Pages lists so you can see which content was edited most recently.
Opens WPIDE on
Code
$wpide_modified_column = function ( $columns ) {
$columns['wpide_modified'] = 'Last Modified';
return $columns;
};
$wpide_modified_value = function ( $column, $post_id ) {
if ( 'wpide_modified' === $column ) {
echo esc_html( get_the_modified_date( '', $post_id ) . ' ' . get_the_modified_time( '', $post_id ) );
}
};
$wpide_modified_sortable = function ( $columns ) {
$columns['wpide_modified'] = 'modified';
return $columns;
};
add_filter( 'manage_posts_columns', $wpide_modified_column );
add_filter( 'manage_pages_columns', $wpide_modified_column );
add_action( 'manage_posts_custom_column', $wpide_modified_value, 10, 2 );
add_action( 'manage_pages_custom_column', $wpide_modified_value, 10, 2 );
add_filter( 'manage_edit-post_sortable_columns', $wpide_modified_sortable );
add_filter( 'manage_edit-page_sortable_columns', $wpide_modified_sortable );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.