Contents
I register a Custom Post Type, and I don’t want it to have its own menu, instead I want to place it as a submenu of an existing admin menu item called my-custom-parent-page.
How to add custom post types in WordPress?
I need a way of adding custom post types to the “Appearance–>Menus” option in WordPress. i have created a custom post type with: All examples I find just add the pages to the menu by manually adding the URL into a custom menu item. I want it to be able to add this automatically by choosing it like any other page.
Then in the “View All” tab of the post type and the top selection should be the archive page. This just masks it to be a custom menu item type instead of having to manually enter it in to create the menu. Currently there is not a way to create a new menu item type other than what is already available to you.
Where do I find the submenu function in WordPress?
This function should normally be hooked in with one of the the admin_menu actions depending on the menu where the sub menu is to appear: admin_menu. The normal, or site, administration menu. user_admin_menu.
Where to find my custom post type in WordPress?
It works, meaning that it’s properly located under the menu my-custom-parent-page, however now when I click on the parent menu (i.e. my-custom-parent-page) it points me to the my_custom_post_type page… Any help? According to the Codex, this is a known and expected behavior:
What happens if post type is not set?
If not set (the default), posts are trashed if post type supports the ‘author’ feature. Otherwise posts are not trashed or deleted. Default null. (array) Array of blocks to use as the default initial state for an editor session.
How to create custom post types in Elementor?
Embed the CPT content in your single and archive templates. Adding the dynamic content is done using Elementor’s Theme Builder templates. Once you finish these steps, your custom post type content will be ready for publishing, and you can display it on any chosen CPT.
View the source code and look for the href of the submenu, for example: #mm-1. Paste this into the URL of the custom link and save the menu. This will make the mobile version work as well when you tap the menu text.
How to add menu page with different name?
However, I want the first item in the list to have a different name (but still point to the same page), the way WordPress itself does it: How could I accomplish that in my plugin?
When to use some string as a submenu?
Note: When using ‘some string’ to show as a submenu of a menu page created by a plugin, this item will become the first submenu item, and replace the location of the top level link. Source: https://codex.wordpress.org/Function_Reference/register_post_type#Arguments (See the “show_in_menu” section)