Support

Account

Home Forums Backend Issues (wp-admin) How to add Existing Custom Post Type Menu to ACF Options Page as a Sub-menu

Solved

How to add Existing Custom Post Type Menu to ACF Options Page as a Sub-menu

  • Greetings,

    I have a plugin, let’s call it “Custom Plugin”, which creates a custom post type called it the “User Profiles”.

    The “User Profiles” CPT displays in the WordPress menu as it’s own Top-Level item along with the usual sub-menu items (All User Profiles, Add New User Profile, etc.)

    Using ACF, I have also created options pages for “Custom Plugin” with several sub-menu pages.

    In the admin menu, the “Custom Plugin” options page displays below my “User Profiles” custom post type menu. So right now the admin menu looks like this:

    User Profiles (the custom Post Type)
    – All user profiles
    – Add new user profile
    – custom taxonomies, etc.
    Custom Plugin (ACF Options)
    – Mange Users
    – Other settings
    – etc.

    What I would LIKE to happen is to have the “User Profiles” CPT as a sub-menu INSIDE my ACF-generated “Custom Plugin” menu. Such that it looks like this…

    Custom Plugin (ACF Options)
    – Mange Users
    – Other settings
    – Etc.
    – User Profiles (the custom Post Type as a sub-menu item)
    — All user profiles
    — Add new user profile

    I have seen a number of tuts showing how to add the options page as a sub-menu to a custom post type, but not the other way around.

    Is this possible?

    Please advise.

    Thanks,
    Preston

  • You have 2 choice.

    The first is that you create your options pages as sub pages of the CPT. This is done by using acf_add_options_sub_page() and setting the parent slug to the URL of your CPT.

    The second option is to set up the CPT under the top level options page. If you do this you will loose links to the standard CPT sub menus (all, add new, etc) and these will only be available from the main CPT admin list page. I have instructions for doing this here https://github.com/Hube2/acf-filters-and-functions/blob/master/acf-options-page-w-cpt-children.php

  • Thanks John for the detailed explanation and demo code. Given the constraints of the 2nd Option, I think I will just have to settle for Option 1, or leave it as is. But you really helped me to understand the issue(s) involved.

    Thanks again,
    Preston

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.