Site logo

Archived topic

Author Remove Permission

3 replies · Started by chris on January 14, 2021

Viewing posts 1–4 of 4

Hi should this be working correctly to make authors posts require approval?

function return_publish_permissions() {
$user = get_role( 'author' );
$user->add_cap( 'publish_posts' );
}
register_deactivation_hook( __FILE__, 'return_publish_permissions' );

function take_away_publish_permissions() {
$user = new WP_User(5);
$user->add_cap('publish_posts',false);
}
register_activation_hook( __FILE__, 'take_away_publish_permissions' );

Doesn't work, quite annoying not sure where im going wrong.

HI thanks sorry it was due to inexperience i dint know all the roles and permissions, i have changed default role to contributor so they can post and edit but without author perms, cheers

Glad to hear you found the answer!

This archived topic is closed to new replies.