How to make Widget accessible by Editor in WordPress?

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');






Copyright © 2020-2021 Engineer Jagat All rights reserved. Developed by Ravindra Rana