Php Freelancer team find some solution on WordPress Add Custom User Roles.
Suppose we create custom post type which is News.Any one can subscribe in our
site and he can add his news.
As above functionality we create new custom user role.which is can manage
only news section in WordPress admin panel.
Add below code in you theme function.php file
Add Custom User Roles
add_role( 'news_user', 'News User', array( 'news' ) );
Using this function we generate the new custom user role which is only manage
news section in WordPress.
Let we see some more function for new custom user role.
Remove User Role In WordPress
Once we create new custom user role in wordpress.we can also remove that custom
role using this function.
remove_role( 'news_user' );
Functions using $wp_roles
And also using $wp_roles you can add role and remove role like this.
global $wp_roles; // for example $wp_roles->add_cap( 'news_user', 'manage_category' ); $wp_roles->remove_cap( 'news_user', 'view_post' );