Support

Account

Home Forums ACF PRO Detect if a field is being loaded for editing or for being displayed Reply To: Detect if a field is being loaded for editing or for being displayed

  • I would most likely conditionally add the filter.

    In functions.php or wherever you are adding the filter

    
    if (!is_admin()) {
      add_filter('acf/load_value/name=field-name', 'your-function-name');
    }
    

    This would mean that the filter would not be applied in the admin or during any ajax requests.

    If you wanted to make it even more specific you could add the filter only just before your got the field. This would ensure that it is only applied when you want it to be applied.

    
    add_filter('acf/load_value/name=field-name', 'your-function-name');
    $value = get_field('field_name');