MilesWeb
MilesWeb Hosting Forum

Please login or register.

Login with username, password and session length

 

News:

SMF - Just Installed!


Author Topic: How to allow contributors to add images in WordPress?  (Read 836 times)

0 Members and 1 Guest are viewing this topic.

Offline Turkey

  • MilesWeb Staff
  • Administrator
  • Full Member
  • *****
  • Posts: 145
  • Karma: +1/-0
    • View Profile
    • MilesWeb - Your Hosting, Our Responsibility!
How to allow contributors to add images in WordPress?
« on: January 15, 2018, 04:42:18 PM »
In WordPress the user "contributor" can add content but cannot upload images using "add media" button. To allow such users to add images, add the below snippet in your themes functions.php file. You can add the code at the end of the file before the tag ?>

Code: [Select]

//Allow Contributors to Add Media Start
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');
}
//Allow Contributors to Add Media End

█ MilesWeb.com - Your Hosting, Our Responsibility!
Unlimited Web Hosting @ Rs.109/mo
Servers in India, UK, US & Romania Datacenter

MilesWeb Hosting Forum

How to allow contributors to add images in WordPress?
« on: January 15, 2018, 04:42:18 PM »