• My 3rd party plug-ins seem fine. My issue is a custom plugin I am trying to develop (code is below). Long story short, I get the world famous:

    “You do not have sufficient permissions to access this page.”

    when I try to load the ‘helloworld’ function without using it as a sub menu page. In other words, doing this:

    admin.php?page=helloworld

    That spits out the permission/access error. Long story short, I need functions to work that are NOT built into the admin menu. The database is not the issue, other plug-ins worked. I am trying to figure out how to fix this since the 1,000 Google searches I did lead to no solution.

    Here is the code. TY. I am pulling my hair out.

    global $wpdb;
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    require_once(ABSPATH . 'wp-includes/pluggable.php');
    
        function fileaccess()
        {
      // basic function that DOES work. I'll spare you the code.
     // All it does is load a directory and display file names inside it.
        }
    
        function helloworld()
        {
        echo "hello, world";
        }
    
        function admin_page()
        {
         add_menu_page('test', 'test', 10, __FILE__, 'fileaccess');
        }
    
    # Add Action
    add_action('admin_menu', 'admin_page');
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jbh

    (@jbh)

    .

    Thread Starter jbh

    (@jbh)

    Unless the idea is that only menu pages, since we assign a permission level, can be accessed that way (page.php?page=function_name)

    So, if I want to create 3 unique functions that are not pages, I can’t call them separately such as admin.php?function=function2_name? Instead, I must create them and call them in a function that IS part of the navigation menu?

    I guess I can do that, I just wanted to see if that is something which is forced on us.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘As Admin, I Can't Load My Custom Plugin Functions’ is closed to new replies.