mercredi 31 décembre 2014

Error: How to allow the “contributor” to upload media in wordpress


am facing a problem with my wordpress site.In my site I prevent/disallow the "contributor" to upload media files.


But I want them to upload only the featured image. So what is the trick in that case?? Is there any code?? or any plugins?? I searched a lot but found nothing related to it. I badly need that. Please help me. Thanks in advance.


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


But when contributor start upload media, its show him an error and cannot upload images and download this file :-



async-upload.php




Aucun commentaire:

Enregistrer un commentaire