0

Hi I have created a custom plugin. The plugin is working fine in the wp-admin. But now I want to my custom plugin can access the editor users role.

How I can manage the permission for my custom plugin.

Please help me out this. Thanks

0

You can wrap the code which you want to limit using the current_user_can() function.

if( current_user_can('editor') ) {
    // true if user is an editor
}

Depending on what you are trying to limit, you can put this conditional around the hook or action that you are adding, or use it to wrap specific functionality within the plugin.

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.