shivgre shivgre - 1 year ago 107
PHP Question

Wordpress subscriber role user cannot upload images from frontend

I am having permissions issue with wordpress website for users with role=


A user with role=
can upload images via wp media uploader from frontend just fine from the same form. But whenever a user uploads image from that same form then in firebug console I see
ajax which returns
with status

And just after that ajax, another ajax is called
with a
which tries to redirect using ajax to

I have tried adding various permission levels in my themes function.php but still the same error :

if ( current_user_can('subscriber') && !current_user_can('upload_files') )
add_action('init', 'allow_subscriber_uploads');

function allow_subscriber_uploads() {

$new_role = get_role('subscriber');

All I see on media upload screen is this error:
An error occurred in the upload. Please try again later.

Any help or hint would be much appreciated.

Wordpress Version of website is: 4.5.3

Answer Source

It was due to some plugin conflict and not due to permission issues for role=subscriber.

I also added members plugin after which the issue was fixed automatically.

I am still not clear how the issue was fixed but adding the members plugin seemed to help.