Created
September 12, 2023 04:29
-
-
Save corypina/c22f5aa2a9cc304d5ed7d4490fe3a41a to your computer and use it in GitHub Desktop.
Check WP roles by capability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Administrator | |
current_user_can('manage_options') | |
// Editor or higher | |
current_user_can('edit_others_posts') | |
// Author or higher | |
current_user_can('publish_posts') | |
// Contributor or higher | |
current_user_can('delete_posts') | |
// author, anyone logged in | |
current_user_can('read') || is_user_logged_in() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment