-
AuthorPosts
-
April 4, 2021 at 10:46 pm #1292374
Hello
Is there an option to let the administrator access all password protected pages without having to enter a password ?I am an admin, and i have password protected pages that i require my users to enter a password in order to check the content. But everytime i try to access these pages while i am logged in as admin, it asks me for the password as well
This is not logical since i am the creator and owner of the page/website
How can i bypass all passwords for pages and posts ?
ThanksApril 5, 2021 at 8:34 am #1292438i found this with a filter to bypass password .
in child-theme functions.php:add_filter( 'post_password_required', 'remove_password_requirement_for_admins', 0 ); function remove_password_requirement_for_admins( $required ) { if ( current_user_can( 'manage_options' ) ) { $required = false; } return $required; }
maybe this will work for admins:
add_filter( 'post_password_required', 'remove_password_requirement_for_admins', 0 ); function remove_password_requirement_for_admins( $required ) { if ( current_user_can( 'administrator' ) ) { $required = false; } return $required; }
you can see here some infos about options in a table : https://wordpress.org/support/article/roles-and-capabilities/#capability-vs-role-table
because manage_options is only for admins allowed the above should work too.April 5, 2021 at 1:22 pm #1292501@Guenni007
THANK YOU SO MUCH ! this saved a lot of my time thanks to your code .. so far it is working good
I only used the second code
I don’t really know what manage-options is ! i only need to bypass password on the blog posts and pagesMany thanks again
April 5, 2021 at 11:22 pm #1292623thats why i link to the list above.
the capabilities are correlated to the roles.
only super admins ( only on multi-site installation) and admins are able to manage options:
April 6, 2021 at 12:47 pm #1292758Thanks again :)
April 8, 2021 at 3:54 am #1293158Hi @Cloudypro,
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardApril 8, 2021 at 10:52 am #1293233Yes it is solved
Thanks you all -
AuthorPosts
- The topic ‘ADMIN BYPASS PASSWORDS’ is closed to new replies.