您可以检查post_status
查询变量并确保将其设置为trash
:
function wpse239286_trash_column( $columns ) {
// Bail if we\'re not looking at trash.
$status = get_query_var( \'post_status\' );
if ( \'trash\' !== $status ) {
return $columns;
}
return array_merge( $columns,
array( \'trash_column\' => __( \'Trash Column\', \'text-domain\' ) )
);
}
add_filter( \'manage_posts_columns\' , \'wpse239286_trash_column\' );
add_filter( \'manage_pages_columns\' , \'wpse239286_trash_column\' );