show_in_admin_bar should affect the "View $post_type" link in the admin bar
|Reported by:||griffinjt||Owned by:||nacin|
When I set the 'show_in_admin_bar' post type parameter to false, I expect it to remove all instances of the post type from the admin bar view. However, it only removes the Add New post type link from the admin bar, but as soon as you go to edit the post type, you are given a link to View the post type in the admin bar.
In wp-includes/admin-bar.php on line 485, it checks for the parameter for adding the new link:
$cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' );
This check can easily be made for the View post type link as well. I've attached a patch that checks for it. Since show_in_admin_bar defaults to true, it won't affect the current setup. It will only hide the link from the menu if you specify show_in_admin_bar to false.
If this isn't the expected way of doing things, then there should be a filter or some other post type arg that will let you hide this link as well.