Set a maximum upload count for users on a specific user role
I’m not really sure which is the real problem with code you posted, however I cant understand why use 2 functions when one is enough… add_filter( ‘wp_handle_upload_prefilter’, ‘limit_uploads_for_user_roles’ ); function limit_uploads_for_user_roles( $file ) { $user = wp_get_current_user(); // add the role you want to limit in the array $limit_roles = array(‘contributor’); $filtered = apply_filters( ‘limit_uploads_for_roles’, … Read more