Support » Plugins » How can I execute php scripts in my plugin folder?

  • I created a plugin which requires several screens. Not all of these screens are accessible, or should be accessible from the dropdown menus.

    The URLs I’m trying to access look like this:


    MyPlugin/Dashboard.php has a link to it from a custom menu I’ve added. The two sub-pages do not.

    My problem is this:

    When I try to access the sub-pages I get this error:

    You do not have sufficient permissions to access this page.

    What do I need to do in order to allow access to the sub-pages?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter evanscode


    So it’s this code in plugin.php (line 947) that’s causing the UI to bomb.

    if ( !isset($_registered_pages[$hookname]) )
        return false;

    $hookname is “admin_page_MyPlugin/SubPageOne.”

    So, is it considered bad-form to stash references in $_registered_pages forcefully?

    Thread Starter evanscode


    OK. I got past this by putting the following code in my main plugin file.

    $_registered_pages["admin_page_MyPlugin/SubPageOne"] = true;

    Don’t use PHP file names, fake or real, as your admin page slug. Use something like: “my-plugin-name-settings” A lot of old examples use __FILE__ — don’t. If you’re passing in a function callback, you can just use any string as the slug.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I execute php scripts in my plugin folder?’ is closed to new replies.