Adding my own custom sub page under the ACF Options menu

So I need to add my own custom page under the ACF (Advanced Custom Fields) “Options” page which I created with the correct code from the ACF site, which is working just fine.

So what I did was this:

Read More
function options_invoiceno(){ ?>
        <div class="wrap">
            <h1>testing sub page</h1>
        </div>
    <?php }

    function add_theme_menu_item() {

        add_submenu_page(
            "acf-options-invoice-design",
            "sub page",
            "sub page",
            "manage_options",
            "invoice-number",
            "options_invoiceno"
        );
    }
    add_action("admin_menu", "add_theme_menu_item");

which gives me the sub menu in the sidebar under “Options”:

sub menu item

But when I click into the menu item I get a 404 Not Found page and the URL is incorrect: e.g. http://example.com/wp-admin/acf-options-invoice-design-sub

Am I missing something? is this even possible to add a sub menu under the existing ACF menu?

Any help or direction will be appreciated.

Related posts

1 comment

  1. Try adding a priority to your menu modifications, and see if that helps:

    add_action('admin_menu', 'add_theme_menu_item', 105 );
    

Comments are closed.