# 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.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: columns, modified, sortable
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/last-modified-column/

## Code

```php
$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 use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Sortable Last Modified Column" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
