Support

Account

Home Forums General Issues acf/upload_prefilter – for every field on options page Reply To: acf/upload_prefilter – for every field on options page

  • You would have to target every acf field and then somehow sort out inside your filter/function when to use the change, but I don’t know if you can sort this out. Uploads are done through AJAX and I do not believe that any information about the options page that’s being viewed is included in the data sent in the AJAX request ($_POST). You may be able to detect if it is an options page, but not a specific options page.

    You could tell what is submitted using something like this

    
    add_filter('acf/upload_prefilter', 'record_submitted_data');
    
    function record_submitted_data($errors) {
      // record $_POST in the error log
      ob_start();
      print_r($_POST);
      error_log(ob_get_clean());
      return $errors;
    }
    

    Then you can upload an image on your options page and then look in your error log to see what you have to work with.