Support

Account

Home Forums Backend Issues (wp-admin) Trying to add an Options Subpage to an Options Page defined by another plugin

Solving

Trying to add an Options Subpage to an Options Page defined by another plugin

  • I’m struggling to get the Options Menu settings to work for me.

    I’m adding an Options Menu via acf_add_options_page() in a plugin that I’m treating as a “parent” plugin that has some global settings and functionality for a multisite network of sites…

    if (function_exists('acf_add_options_page')) {
       acf_add_options_page(
          array(
             'page_title' => 'Geauga Connected Dashboard',
             'menu_title' => 'Geauga Connected',
             'menu_slug'  => 'geauga-connected-dashboard',
             'capability' => 'edit_posts',
             'redirect'   => false,
             'position'   => 2,
          )
       );
    }

    What I want to do is use acf_add_options_sub_page() within other plugins to add submenus to the “parent” plugin’s Options Page…

    if (function_exists('acf_add_options_sub_page')) {
       acf_add_options_sub_page(
          array(
             'page_title'  => 'Alert Bar Settings',
             'menu_title'  => 'Alert Bar',
             'parent_slug' => 'geauga-connected-dashboard',
             'capability'  => 'manage_options',
             'menu_slug'   => 'alert-bar-settings',
             'position'    => 10,
          )
       );
    }

    No matter what I’ve tried, I cannot get the submenu to display at all. I’ve messed with the hook priority settings, ie. loading the “parent” plugin’s acf/init hook before the other plugin’s acf/init hook, but the submenu is not being added.

  • Are you saying that the plugin is already using ACF and that the first code that you supplied is how that plugin is adding the options page?

  • @hube2 Yes, the first code block is how the main plugin is adding the Options Page – sorry for the confusion.

  • The only thing that I can think of is that the sub page code is being called before the parent page is added. I would wrap the code in acf/init actions so that I could control the order they are run by setting priority.

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

You must be logged in to reply to this topic.