How to make Widget accessible by Editor in WordPress?

WordPress can be Easily Customized and easy to maintain. In this post, you will get to know how to make widgets accessible by Editor in WordPress.

In WordPress, there are multiple User Roles like Subscriber, Contributor, Author, Editor, and Administrator.

Widgets are components used for a different purpose, literally, we could use them for Advertisements and so on.

Here is the code to make Widget accessible by Editor in WordPress. Paste it to functions.php

function extend_editor_caps()
{
   
    $roleObject = get_role('editor');

    if (!$roleObject->has_cap('edit_theme_options')) {
        $roleObject->add_cap('edit_theme_options');
    }
}
add_action('admin_init', 'extend_editor_caps');

All rights Reserved © Ravindra Rana - 2021

Hello, How are you doing?
Holler Box
2 Shares
Tweet
Share2
Share
Pin