Support

Account

Home Forums Backend Issues (wp-admin) Dynamically set image field to readonly/disabled?

Helping

Dynamically set image field to readonly/disabled?

  • I’m trying to use the acf/load_field callback to dynamically set some fields to readonly and/or disabled. This works fine for most fields, but doesn’t appear to work for image fields. Is it possible to dynamically block image fields from being changed in the backend?

    
        add_filter('acf/load_field/name=test_image', function($field) {
            $field['readonly'] = 1;
            $field['disabled'] = 1;
            return $field;
        });
    
    
  • Not by using that filter. Those settings only work for simple fields. I do not know the details but this is probably something that you’d need to do using JavaScript. To be honest I’m not even sure if that’s possible.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.