Wednesday 28 December 2016

Create custom user roles in WordPress

Methode 1:-

Add following code in "functions.php" file


// Add a custom user role

$result = add_role( 'client', __('Client' ),
array(
'read' => true, // true allows this capability
'edit_posts' => true, // Allows user to edit their own posts
'edit_pages' => true, // Allows user to edit pages
'edit_others_posts' => true, // Allows user to edit others posts not just their own
'create_posts' => true, // Allows user to create new posts
'manage_categories' => true, // Allows user to manage post categories
'publish_posts' => true, // Allows the user to publish, otherwise posts stays in draft mode
'edit_themes' => false, // false denies this capability. User can’t edit your theme
'install_plugins' => false, // User cant add new plugins
'update_plugin' => false, // User can’t update any plugins
'update_core' => false // user cant perform core updates
)
);


Methode 2:-

Install "User Role Editor" plugin from "https://wordpress.org/plugins/user-role-editor/"

Ankit Shah PHP Expert

IT New Code suggest a solution for your problem related to coding, Specially .PHP, Wordpress, WooCommerce, Magento, HTML and CSS. Visit Our website for Information.

0 comments:

Post a Comment

 

Copyright @ 2016 IT New Code | Developing Code | Designing Code.

Designed by: Ankit Shah