Online Forum To Support Coders With Technical Assistance - Read Write Execute

How to add/remove user role in wordpress

Ankit Agrawal
Ankit Agrawal
Published on December 2, 2016 · 1 min read

users role in wordpress add/remove

For role add use below function

$aRole = "Your role name";
$aDisplayName = "Role display name";
$aCapabilities = array();
add_role( $aRole, $aDisplayName, $aCapabilities );

For role remove user below function

$aRole = "Your role name";
remove_role( $aRole );
Was this article helpful?
Ankit Agrawal

Ankit Agrawal

Author & Senior Engineer at CodeExecute

Writing practical engineering guides, debugging real-world bottlenecks, and creating free tools for developer productivity.

← Previous Article Post data using curl Next Article → How to create wordpress theme woocommerce supportable