prevent_admin_access() breaks admin-post.php functionality
-
The plugin has an option to choose what roles won’t be able to access the admin area, which is great, but it also breaks handling form data with admin-post.php
I ended up leaving that option empty, copying this function to my functions.php and hardcoding
$option_roles = array('subscriber');
.To allow users to reach admin-post.php, I added this to my copied function:
$adminPostFilename = '/wp-admin/admin-post.php'; if(substr($_SERVER['PHP_SELF'], -strlen($adminPostFilename)) === $adminPostFilename){ return; }
This is not a great solution, but works. If there’s a better way to do that, I’m all ears, but it would be nice to have that in the official code.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘prevent_admin_access() breaks admin-post.php functionality’ is closed to new replies.