You can check the value of the post_status
query variable and make sure that it's set to trash
:
function wpse239286_trash_column( $columns ) {
// Bail if we're not looking at trash.
if ($status != issetget_query_var( $_GET['post_status']'post_status' );
|| if ( 'trash' !== $_GET['post_status']$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' );