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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.