As Admin, I Can't Load My Custom Plugin Functions
-
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)
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.