Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Using A WordPress User Role

Does your WordPress site have multiple authors contributing to your blog posts? Perhaps you use the predefined WordPress user role of Author or Contributor? I’m going to share with you my experience with WordPress user roles.


WordPress user roles are used so that you can grant other users access to your site to create posts and even Envira galleries without giving them access to your theme or plugin sections of your WordPress admin. However, there are many differences for each WordPress user role. You can read more about WordPress roles here from our friends at WPBeginner.

Adding a WordPress user role

You may ask: “What is the difference between the role Contributor and the role Author?”

Contributor roles can create and edit their own posts as well as delete their own posts (as long as they are not currently published). However, they do not have access to publish posts or upload images. This seems less likely of a solution if you were wanting them to be able to insert images into their posts or even create galleries to use in their posts.

Author roles have the access to create, edit and publish posts as well as delete posts (including published ones) and upload images. This means they could easily create a gallery and insert that into their post as well.

You can give your users the ‘Contributor’ role and easily give them access to upload images and create galleries just by changing their role using either a plugin or a custom function.

You can use a a free plugin like User Role Editor. This plugin will allow you to manage the permissions each role has.

Note: Before adding any custom function to your theme it is important to use a child theme first. This will allow you to keep your theme updates current without losing any edits you’ve made to your theme.

For tips on creating a child theme, please visit this article from WPBeginner.

Alternatively, you can use a child theme and a custom function to give users with the Contributor role permission to upload images to all posts and pages (including Envira galleries). Just copy the code below and place it into your child theme’s functions.php at the bottom of the file before the closing php tag.

if ( current_user_can('contributor') && !current_user_can('upload_files') )
    add_action('admin_init', 'allow_contributor_uploads');
function allow_contributor_uploads() {
    $contributor = get_role('contributor');
    $contributor->add_cap('upload_files');
}

Thats it! Now you know a little more about WordPress user roles. Want to add the comment functionality to your Envira Gallery Standalone pages? Check out our helpful doc on that here.