This WordPress customization adds a “Last Modified” column to the post and page lists in the admin dashboard, making it sortable and enabling more efficient content management. Below is an overview of the steps to implement this customization.
Importance of Displaying the Last Modified Date
By showing the last modified date, you can instantly identify which articles have been recently updated. This not only provides fresh information to readers but also helps improve SEO effectiveness.
Edit the functions.php File
Add code to the functions.php file of your WordPress theme. This file is typically located inside your WordPress theme folder. Add code that inserts a “Last Modified” column into the post and page lists. Additionally, include code that makes the column sortable.
/* Add a "Last Modified" column to the post and page lists */
function add_posts_columns_last_modified( $columns ) {
$columns[ 'modified-last' ] = 'Last Modified' ;
echo '';
return $columns ;
}
add_filter( 'manage_posts_columns', 'add_posts_columns_last_modified' ) ;
add_filter( 'manage_pages_columns', 'add_posts_columns_last_modified' ) ;
/* Display the last modified date */
function custom_posts_columns_last_modified( $column_name, $post_id ){
if( 'modified-last' != $column_name ){
return ;
}
$modified_date = the_modified_date( 'Y年Md日 Ag:i' ) ;
$modified_author = get_the_modified_author() ;
echo $modified_date ;
}
add_action( 'manage_posts_custom_column', 'custom_posts_columns_last_modified', 10, 2 ) ;
add_action( 'manage_pages_custom_column', 'custom_posts_columns_last_modified', 10, 2 );
/* Make the column sortable */
function sort_columns_last_modified( $columns ){
$columns['modified-last'] = 'modified' ;
return $columns ;
}
add_filter( 'manage_edit-post_sortable_columns', 'sort_columns_last_modified' ) ;
add_filter( 'manage_edit-page_sortable_columns', 'sort_columns_last_modified' ) ;
- The
add_posts_columns_last_modified
function adds the “Last Modified” column to the post and page lists. - The
custom_posts_columns_last_modified
function displays the actual “Last Modified” date. - The
sort_columns_last_modified
function makes the “Last Modified” column sortable.
Admin Dashboard Display
With this change, a “Last Modified” column will be added to the post and page lists in the WordPress admin dashboard.
You can toggle the visibility of the “Last Modified” column using the “Screen Options”.
Clicking the “Last Modified” column allows you to sort posts/pages in descending or ascending order by date.

- You can easily identify recently updated articles.
- You can manage and update content more efficiently.
Important Notes
When adding code, be careful not to interfere with existing functionality.
If you are using a child theme, add the code to the child theme’s functions.php
file.
WordPress or theme updates may affect this customization. Regular checks and adjustments as needed are recommended.
In Conclusion
This customization makes the WordPress admin dashboard more user-friendly and allows for more efficient content management.
*Use at your own risk if reusing this code.