How To Allow Contributors to Add Media in WordPress

Last Updated On : Monday, March 21, 2016
3

If you are running a multi-author WordPress blog, where a subset of users are with contributor role, by default WordPress users under contributor role are not allowed to upload any media content and Add Media button will not be visible to them. But this quite annoying, the user who wants to make his post more interactive, then they need to add some images/videos to the post. Today, I came with a simple tweak to enable Add Media button to contributors which Allow Contributors to Add Media in WordPress. This will be very helpful to the WordPress admins who are accepting guest posts from multi authors.

A simple 5 line of code will enable Add Media button to contributors. Let’s see the steps.

How To Steps:

  1. Administrators, Login to your WordPress admin panel.
  2. Then open functions.php file of your current WordPress theme in edit mode. You can go to functions.php page by navigating to Appearance > Editor and then choose functions.php.WordPress Editor
  3. functions.php of your current theme will be available from the list of files under WordPress functions fileTemplates menu on the right side on the Editor page. Here add the below snippet of code inside the functions.php file and click Update File.

Please find the snapshot of functions.php in WordPress Panel where I added the code.

/*Contributor Media Upload*/
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’);
}

How To Allow Contributors to Add Media in WordPress

Once you have updated the file. Your contributor now able to see the Add Media button on Posts page.

Note: If you are unfamiliar with editing the codes, please take a backup before you edit.

Happy Blogging !!!

If you have any doubts, feel free to leave a comment.

  • Hai just now i read your tuts please add this two steps because function.php is main file in our theme before modify your theme better your create a child theme or site specf wordpress plugin.

    step 1 create a child theme for add our extra function’s
    example code

    /*

    Theme Name: techolead Child Theme

    Theme URI: http://www.techolead.com/

    Description: A Twenty Thirteen child theme

    Author: ashok

    Author URI: http://www.techolead.com

    Template: twentythirteen

    Version: 1.0.0

    */

    @import url(“../twentythirteen/style.css”);

    – style.css & function.php file
    in function.php file add your media upload wordpress code

    =========

    step 2 create a site specific wordpress plugin check the below format

    =========

    • Thanks Santhosh for your suggestions.. Let me check.

      • Newspaper theme has child theme support. Download the entire package from themeforest and you will find a child theme there.