[wp-trac] [WordPress Trac] #20504: show_in_admin_bar should affect the "View $post_type" link in the admin bar

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 21 13:32:32 UTC 2012


#20504: show_in_admin_bar should affect the "View $post_type" link in the admin bar
--------------------------+------------------------------------
 Reporter:  griffinjt     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Toolbar       |    Version:  3.3.1
 Severity:  normal        |   Keywords:  has-patch dev-feedback
--------------------------+------------------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20504>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list