Allow Contributors to Upload Images in WordPress: By default, WordPress does not permit contributor accounts to upload images.

You can, of course, promote that particular account to Author or Editor and this will give them the rights to upload and modify images.

However, it will also grant them additional rights, such as the ability to publish their own articles (as opposed to submission for review).

 

This particular code snippet allows contributor accounts to upload images to their articles, without granting them any additional privileges or rights. Paste it in the functions.php file of your theme. Add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.

 

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

Save the file and test by logging as a contributor role. You should see the “Add media” button or ability to upload the images. 🙂


Related Videos:

 


Related Posts:

Show Post Thumbnails in RSS Feed – WordPress

Disable the Admin Bar in WordPress

Formatting Text in WordPress Posts (Tiny MCE Advanced for WordPress)

Should I Choose a Hosted or Non-hosted Blogging Platform?

WordPress, SEO, and Social Media Marketing

Change the Author Permalink Structure

How do I install plugins in WordPress?

Choose your preferred blog CMS platform

Protect Your Site from Malicious Requests

WordPress by the Numbers Facts

Paginate Your WordPress Site Without Plugins

Create a PayPal Donation Shortcode – WordPress

WordPress Posts vs Pages

Show Popular Posts Without Plugins

Automatically Link to Twitter Usernames in Content

How do I create money online using WordPress?

How to Update: Automatically create media_buttons for shortcode selection

Disable Search in WordPress

Using the Current Year in Your Posts – WordPress

Hackers Have Just Put 620 Million Accounts Up For Sale On The Dark Web — Are You On The List?

How to secure your Nest account and cameras and keep hackers at bay

Avada Theme Version 5.5.2

What is the use of New Keyword in VB.NET?

Are there copyright restrictions on the use of Python?