Support » Plugins » Hacks » Sort Admin edit.php Post List By Modified Instead of Published

  • I have a site that has posts that are individual products, and site-side display order is based on categories. Admin side, I would like the list of posts in wp-admin/edit.php to be able to display and sort by latest Modified date instead of published date, because I need to see which posts are the least recently modified so I can update them, and I don’t care when they were first published.

    In spite of searching high and low on these forums, the web, and plugins for a simple answer or something that will let me do this, I’ve had no luck and it’s a bit beyond my ken to know exactly what to look for and where in the files at the moment.

    Just guessing that the edit will need to happen somewhere in one of these:
    Or edit.php ?

    And to be looking for an orderby=post_status or something to change it to orderby=modified_date

    Any help would be greatly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter C450104


    Ok, so still digging for answers, found this page:

    Curtiss Grymala Member Posted 8 months ago
    Obviously, you shouldn’t actually modify edit.php, as any changes will be overwritten when you upgrade WordPress.
    However, you can try to use the manage_posts_columns filter to add a new column showing the scheduled/published time.

    Which lead me to this:

    It doesn’t have an example of my specific need, but I’ll keep looking to see if I stumble onto something.

    So now at least I know I shouldn’t be messing with the edit.php or any other files like that.

    Thread Starter C450104


    Woot! My issue is resolved! Found something that does what I needed:

    This came with 2 default new columns that it added to the Posts page that I didn’t really need, but gave me the plugin framework I needed to tweak and add what I wanted.

    For anyone coming after me, in the custom_admin_columns.php file, find:

    function cac_post_column_filter($columns) {
        $columns['thumbnail'] = 'Featured Image';
        $columns['slug'] = 'Permalink';
        return $columns;
    add_filter('manage_post_posts_columns', 'cac_post_column_filter');

    After $columns['slug'] = 'Permalink'; Add:
    $columns['date_modified'] = 'Date Modified';
    Then find:

    function cac_column_value($name, $id){
    case 'slug':
           $permalink = get_permalink($id);
    	echo '<a href="'. $permalink . '" target="_blank">' . $permalink . '</a>';
    case 'thumbnail':
    	echo get_the_post_thumbnail($id, array(75,75));

    After the Thumbnail case, add:

    case 'date_modified':
    		echo the_modified_date();


    I also added a few other custom post field columns to my file from using ADV Custom Fields:

    If anyone ever wants to know how I’ve implemented those, feel free to email me or reply to this post, I’m subscribed.

    Thread Starter C450104


    I think I’ll probably be using this guide to expand the functionality of my custom fields by adding them to the Quick Edit section of my site:

    …And I’m just posting this here for posterity’s sake.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort Admin edit.php Post List By Modified Instead of Published’ is closed to new replies.