WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#14263 closed enhancement (invalid)

Create show_admin_menu option

Reported by: CalebKniffen Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:

Description

When show_ui is true and show_in_nav_menus is false menus sometimes show up still.

This issue was discovered because I was attempting to consolidate several custom post types under one menu heading. Even though show_in_nav_menus was false it would still show but only the last one I had created.

The solution is simple. In wp-admin/menu.php I added a filter to only include post_types that have show_in_nav_menus set to true.

Attachments (1)

show_in_nav_menu-patch.diff (790 bytes) - added by CalebKniffen 5 years ago.
Patch

Download all attachments as: .zip

Change History (9)

@CalebKniffen5 years ago

Patch

comment:1 @filosofo5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 3.0 deleted

"nav menus" are the ones that possibly show on the front-end of your blog, as opposed to the "admin menus," which are the ones that print URLs to move around the admin area of WP.

comment:2 follow-up: @CalebKniffen5 years ago

Any idea why it was only adding the last one then when I had several. Because if I make show_ui = false then I cannot even get to the editing page of the post type even if directly linking. I understand this as intended. Should then there be an aditional show_admin_menu option? I see this as being a common issue for many plugin developers wanting to combine several custom post types under one admin menu group.

comment:3 @CalebKniffen5 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Summary changed from show_in_nav_menus is false and menus still show to No way to disable admin menus for a post type but still have editing pages
  • Type changed from defect (bug) to enhancement

comment:4 @CalebKniffen5 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

comment:5 @CalebKniffen5 years ago

  • Summary changed from No way to disable admin menus for a post type but still have editing pages to show_in_nav_menus is false and menus still show
  • Type changed from enhancement to defect (bug)

When show_ui is true admin menus show up. If it is desired that the admin menu does not show up but you want to still link to the management pages for that post type there is no way to do that.

This issue was discovered because I was attempting to consolidate several custom post types under one menu heading.

comment:6 @duck_5 years ago

  • Keywords close added; custom post types removed

Turning into a duplicate of #14145 ?

comment:7 in reply to: ↑ 2 @filosofo5 years ago

  • Keywords needs-patch added; close removed
  • Milestone set to Future Release
  • Summary changed from show_in_nav_menus is false and menus still show to Create show_admin_menu option
  • Type changed from defect (bug) to enhancement
  • Version set to 3.0

Replying to CalebKniffen:

Should then there be an aditional show_admin_menu option?

Perhaps, but the point is that show_in_nav_menus has nothing to do with it.

comment:8 @nacin5 years ago

  • Milestone Future Release deleted

Closing as duplicate of #14145. The patch there would allow you to hide the menu (in addition to having it in a submenu).

Note: See TracTickets for help on using tickets.