WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#27286 new enhancement

create menu page for custom post types

Reported by: norcross Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.8
Component: General Keywords: has-patch dev-feedback
Focuses: administration Cc:

Description

Currently, there are dedicated functions for adding new items to a top-level navigation item, such as add_posts_page, add_media_page, add_links_page, and so on. These all act as a wrapper for the add_submenu_page. However, there is no dedicated function for custom post types. I am proposing to add a new function called add_post_type_page that works in the same way. It's basically a copy of add_posts_page with an additional parameter for the registered CPT.

Attachments (1)

27286-plugin.php.diff (1.6 KB) - added by norcross 4 years ago.
plugin.php file with additional function

Download all attachments as: .zip

Change History (6)

@norcross
4 years ago

plugin.php file with additional function

#1 @norcross
4 years ago

  • Keywords has-patch dev-feedback added

#2 follow-up: @nacin
4 years ago

Hmm. Aside from the fact that add_post_type_page() is far, far too ambiguous of a name (not your fault, you're just following existing convention), what's the use case here?

Perhaps something like #17447 would solve your issue?

#3 in reply to: ↑ 2 @norcross
4 years ago

Replying to nacin:

Hmm. Aside from the fact that add_post_type_page() is far, far too ambiguous of a name (not your fault, you're just following existing convention), what's the use case here?

Perhaps something like #17447 would solve your issue?

I agree the name is vague, but wasn't sure about naming outside the convention.

My particular use cases are as follows:

  • settings page for a plugin using CPTs
  • archive page info (page title / description) for CPT (not a taxonomy)
  • a drag and drop sorting page for CPT

these are just examples of things I've done this week for actual client work.

the ticket you referenced wouldn't address this as it isn't modifying an argument to the post type itself, rather, adding a new menu page.

actual hook naming aside, my goal here was standardization, since CPTs are now so widely used.

#4 @SergeyBiryukov
4 years ago

  • Version changed from trunk to 3.8

#5 @celloexpressions
3 years ago

  • Component changed from Menus to General
  • Focuses administration added

*Admin* menu, not Menus

Note: See TracTickets for help on using tickets.