Code Snippets

Allow User to Upload Images – PHP Code Snippet

In WordPress theme there’s no option for contributes to upload images. In fact, WordPress doesn’t allow users to do so until you give them privilege. You’ll have to make them Editor or Author so images can be uploaded by them but code snippet facilitate Allow User to Upload Images. They don’t even need any additional privileges.

Permit User to Upload Images – PHP Code Snippet

Paste it in the functions.php file of your 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');

Passion is beyond limitation. If you’re passionate about ANYTHING, nobody can stop you not to do what you want. Blogging and Web Designing is my passion that don’t drive me to do what I want but push me as well to share fanatical stuff with people.

Write A Comment