2

I created a custom plugin which i want Users who are Editors to be able to use the plugin.

I found a link here to allow access for editors to allow editors to edit menusallow editors to edit menus?

using this code.

    $role_object = get_role( 'editor' );

// add $cap capability to this role object
$role_object->add_cap( 'edit_theme_options' );

So, is there a possible way i can allow Editors access to my custom added plugins

4

Please add the following code.

function activate_plugin_name() {
   $role = get_role( 'editor' );
   $role->add_cap( 'manage_options' ); // capability
}
// Register our activation hook
register_activation_hook( __FILE__, 'activate_plugin_name' );

function deactivate_plugin_name() {

  $role = get_role( 'editor' );
  $role->remove_cap( 'manage_options' ); // capability
}
// Register our de-activation hook
register_deactivation_hook( __FILE__, 'deactivate_plugin_name' );`

Refer my tutorial for further explanation. http://www.pearlbells.co.uk/user-role-editor-access-wordpress-plugins/

2

After a quick search, i got my answer here

https://wordpress.org/support/topic/how-to-allow-non-admins-editors-authors-to-use-certain-wordpress-plugins

By changing all occurances of 'manage_options' to 'edit_pages' in my Plugins files.

Editors are allowed to use plugins with Edit_pages

  • I tried your suggestion but did not worked for me. Can you give more details of how to accoplish that?, please – Alejo_Blue Jun 19 '18 at 16:35
  • Okay, do you need a sample Plugin code snippet on Github? That should work – user123451 Jun 20 '18 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.