Not Allowed when using current_user_can
-
I’m creating a plugin.
I’m using AJAX for administrative tasks and most of the plugin is handled in a PHP class.
Everything so far is working well. It only takes one line to break the whole thing and give me a blank window with only “Sorry, you are not allowed to access this page” showing.
That one thing is to add this line.
$hasAuthority = current_user_can("edit_posts");
The following are all pieces of evidence:
- It isn’t just current_user_can. I get the same error if I try to use wp_verify_nonce() also.
- This is only a problem when it happens in a function that is part of the class. If I put the same line in a function that isn’t part of the class, it has no problem.
- I am on a network. The plugin is Network Activated. I’m testing the plugin in the main site of the network.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Not Allowed when using current_user_can’ is closed to new replies.