Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#20504 closed defect (bug) (fixed)

show_in_admin_bar should affect the "View $post_type" link in the admin bar

Reported by: griffinjt's profile griffinjt Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.3.1
Component: Toolbar Keywords: has-patch dev-feedback
Focuses: Cc:

Description

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.

Attachments (1)

admin-bar-patch.diff (585 bytes) - added by griffinjt 13 years ago.

Download all attachments as: .zip

Change History (5)

#1 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.5

Okay. I'd be more interested in hiding the edit link but I understand this as well.

#2 @griffinjt
13 years ago

I'd be fine with that as well. It's just misleading when you set it to false and yet something about the CPT still appears in the bar.

Last edited 13 years ago by griffinjt (previous) (diff)

#3 @nacin
12 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [21957]:

Check a post type's show_in_admin_bar property for 'View' and 'Edit' object links. Previously show_in_admin_bar was only checked for the add new menu. fixes #20504.

#4 @nacin
12 years ago

For [21957], props griffinjt — sorry about that.

Note: See TracTickets for help on using tickets.