Answers for "create role wordpress"

PHP
2

wordpress make custom role

/* Create Staff Member User Role */
add_role(
    'staff_member', //  System name of the role.
    __( 'Staff Member'  ), // Display name of the role.
    array(
        'read'  => true,
        'delete_posts'  => true,
        'delete_published_posts' => true,
        'edit_posts'   => true,
        'publish_posts' => true,
        'upload_files'  => true,
        'edit_pages'  => true,
        'edit_published_pages'  =>  true,
        'publish_pages'  => true,
        'delete_published_pages' => false, // This user will NOT be able to  delete published pages.
    )
);
Posted by: Guest on September-29-2020
0

wordpress create user role programmatically

function ui_new_role() {  
 
    //add the new user role
    add_role(
        'power_member',
        'Power Member',
        array(
            'read'         => true,
            'delete_posts' => false
        )
    );
 
}
add_action('admin_init', 'ui_new_role');
Posted by: Guest on October-18-2021

Browse Popular Code Answers by Language