• Hey all,

    A client has a very specific request and my Googling hasn’t come up with any results.

    The client wants the trashed posts (of a specific custom post type) to show their modified date instead of the creation date when listed in the back-end of WordPress. The post_modified is updated when you change its status from publish to trash so this should be accurate.

    I was wondering which hook to investigate or even a source file that I can change to accommodate this. As mentioned before, I have Googled for an answer but haven’t come up with anything.

    Any help or insight is greatly appreciated. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it with the ‘post_date_column_time’ hook if it’s the date shown in the “Date Column”. Something like this:

    add_filter( 'post_date_column_time', 'trash_time_column', 10, 4 );
    function trash_time_column( $h_time, $post, $column_name, $mode ) {
    	// change the post_type to your post type
    	if ( ( $post->post_status == 'trash' ) && ( $post->post_type == 'post' ) ) {
    		$post_modified = mysql2date( __( 'Y/m/d' ), $post->post_modified );
    		return  $post_modified;
    	}
    
    	return $h_time;
    }

    Thread Starter Bonesnap

    (@bonesnap)

    Thanks for the quick reply. I’m going to give this a shot and I’ll post my results.

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to make trashed posts show post_modified instead of post_date’ is closed to new replies.