How to Allow Contributors to Upload Files in Wordpress

How to Allow Contributors to Upload Files in Wordpress

Most multi-user Wordpress blogs use user roles such as "Contributor" which allows users to write and send posts for moderation. But one thing which lacks in this role is ability to upload files. So, here is a simple code to enable it.

Open functions.php file of your theme and paste the following code:

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

It will enable upload files feature for contributors.

This code was shared by Ryan Marganti

Jared
April 8, 2010 10:45 AM

Awesome, I’ve been needing this thanks!

RRH
April 9, 2010 0:16 AM

Thanks buddy, you solve my problem.

Ryan Marganti
April 19, 2010 4:23 AM

Glad my solution has been of some help to everyone. Thanks for the credit.

pej
August 13, 2010 7:05 AM

i love you man

[...] thanks to Altaf Sayani for his contribution to WpRecipes! If you enjoyed this article, please consider sharing it! [...]

[...] instalar un plugin "solo para eso", y no requieres del resto de funcionalidades del mismo, puedes añadir estas líneas al fichero functions.php: Clic para ver Texto Plano [...]

[...] e atribuir esta nova capacidade, ou se você não quer instalar um plugin só para isso, você pode adicionar estas linhas no arquivo functions.php do seu [...]

Leave a Reply