Advertisement
fauzanjeg

restrict role author from publish post

May 31st, 2021
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. /* restrict role author from publish post */
  2. function restrict_role_author_from_publish_post() {
  3.     $user = wp_get_current_user();
  4.     if ( in_array( 'author', $user->roles ) ) {
  5.         $user->add_cap( 'publish_posts', false );
  6.     }
  7. }
  8. add_action( 'init', 'restrict_role_author_from_publish_post' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement