How to sort Posts by modified date in WP Dashboard?

#1

Hi there,

I just wanted to know if there is any way in which we can sort and display posts by Last Modified Date in WordPress Dashboard’s Posts section?

#2

Hello, which theme are you using?

#3

Voice theme by meks.

#4

Add below snippet using Code Snippets plugin.

// Sort posts by last modified at Homepage, Search and Archives
function modified( $query )
{
    if ( $query->is_main_query() && ( $query->is_home() || $query->is_search() || $query->is_archive() )  )
    {
        $query->set( 'orderby', 'modified' );
        $query->set( 'order', 'desc' );
    }
}
add_action( 'pre_get_posts', 'modified' );
1 Like
#5

Thank You

#6

You’re welcome!

1 Like