Force Basic Uploader in ACF

WordHerd just finished building a custom user database and profile search in WordPress for a customer.

The Issue with Publicly Accessible ACF Image Fields

When building the user database we needed to add additional image fields to user profiles. The issue was that when a user logged in to edit their profile they would have access to the media library through the image uploader.

Converting ACF Image Fields to the Basic Uploader

In order to resolve this we found a great solution from a Guru on the ACF forum, but we had to tweak the code slightly. Below is a tweaked version of the code he provided. The only difference is that the original was meant for the front-end, where as this is for the admin user edit page.

// force basic uploader for a certain field
function my_acf_force_basic_uploader( $field ) {

// set the uploader setting before rendering the field
acf_update_setting('uploader', 'basic');

return $field;
}

// target the field using its name (Replace field_name)
add_filter('acf/prepare_field/name=field_name', 'my_acf_force_basic_uploader');

The filter assigns a custom function my_acf_force_basic_uploader to the ACF field before it’s rendered. This allows us to filter the field data before display, which is where we use acf_update_setting to change the uploader to ‘basic’, telling ACF not to use the media library uploader.

Reference post: https://support.advancedcustomfields.com/forums/topic/enable-basic-uploader-for-frontend-comments/


WordHerd provides website migration services from any CMS platform to WordPress. In addition to moving your content and converting your theme, we can also migrate custom data to Advanced Custom Fields (ACF) through our powerful processing tool, the Wrangler. If you have a CMS or customer that you need help moving get a free evaluation.