# Recently Updated Content Widget

> Lists the most recently modified posts and pages of any type on the dashboard, with who changed them.

- Type: PHP
- Runs: Admin only
- Category: [Dashboard](https://wpide.com/library/category/dashboard/)
- Tags: dashboard, widget, activity
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/recently-updated-content-widget/

## Code

```php
add_action( 'wp_dashboard_setup', function () {
    if ( ! current_user_can( 'edit_posts' ) ) {
        return;
    }

    wp_add_dashboard_widget( 'wpide_recently_updated', 'Recently Updated', function () {
        $items = get_posts( array(
            'post_type'   => array_values( get_post_types( array( 'show_ui' => true ) ) ),
            'post_status' => array( 'publish', 'draft', 'pending', 'future', 'private' ),
            'numberposts' => 10,
            'orderby'     => 'modified',
        ) );

        echo '<ul>';
        foreach ( $items as $item ) {
            if ( ! current_user_can( 'edit_post', $item->ID ) ) {
                continue;
            }
            $editor_id = (int) get_post_meta( $item->ID, '_edit_last', true );
            $editor    = $editor_id ? get_userdata( $editor_id ) : false;
            printf(
                '<li><a href="%1$s">%2$s</a> <span style="color:#646970">%3$s ago%4$s</span></li>',
                esc_url( get_edit_post_link( $item->ID ) ),
                esc_html( get_the_title( $item ) ? get_the_title( $item ) : '(no title)' ),
                esc_html( human_time_diff( get_post_modified_time( 'U', true, $item ), time() ) ),
                $editor ? esc_html( ' by ' . $editor->display_name ) : ''
            );
        }
        echo '</ul>';
    } );
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Recently Updated Content Widget" 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/
