add_action( 'views_edit-post', 'child_remove_some_post_views' );
/**
* Remove All, Published and Trashed posts views.
*
* Requires WP 3.1+.
* @param array $views
* @return array
*/
function child_remove_some_post_views( $views ) {
unset($views['all']);
unset($views['publish']);
unset($views['trash']);
return $views;
}
Similar views can be edited by hooking into 'views_' . $screen->id where $screen is the global $current_screen (or get_current_screen()). Draft, Pending, Mine and Sticky could all be removed in a similar manner.
can you remove on the post count and not the name itself? If so how would i go about doing that?
Hi Gary, can we remove those views in Custom Post Type edit screen ? I’ve tried with that but failed…
something like this, but it did not work :
if( get_post_type() === ‘movie’ ) {
unset($views['all']);
unset($views['publish']);
unset($views['trash']);
}
return $views;
I suspect you could leave my demo function the same, but change the hook it is applied to – instead of
views_edit-post, tryviews_edit-moviefor instance.Thanks for your quick reply! It woks like a charm, yesss