简体   繁体   中英

Wordpress - User role

I really hope that someone are able to point me into some direction with this.

I'm building a wordpress site, with an admin user as the main "top admin" of the whole webpagepage.

/root "top admin"/directory/../../.. "to bottom of the site".

What I want to do, is to have a "sub admin" that is able to edit (not delete the page or add new pages) the subpage and add new posts.

/root "top admin"/directory/home-root of "sub admin"/sub-directory1/ "posts ect"

and another "sub admin2"

/root "top admin"/directory/home-root of "sub admin2"/sub-directory2/ "posts ect"

It's for a news page, where the subpage serves as an index of the posts, made in that subpage. Then the updated content will be shared from the subpage to the main frontpage, and update the content, when there is new content added in the sub level directories.

Hope you are able to help me. Thank you.

There are two ways you could go about this,

First you could add the new role manually into the functions.php file of your theme, which would go like this:

function wporg_simple_role()
{
add_role(
    'simple_role',
    'Simple Role',
    [
        'read'         => true,
        'edit_posts'   => true,
        'upload_files' => true,
    ]
);
}

// add the simple_role

add_action('init', 'wporg_simple_role');

See more about this option here Checkout all the Wordpress User Roles and Capabilities and pick the ones that fit your needs.

The other option would be to use one of the many plugins out there that adds, edit and deletes user roles for you.

I personally recommend the User Role Editor plugin , I've used it and it works like a charm, just make sure you add the right capabilities.

I hope that sets you in the right path.

PS: Sorry for not adding a link to the plugin, I just recently joined Stackoverflow and don't have enough rep to post more than two links.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM