Home › Forums › General Issues › Easier way $_POST['acf'] with get_fields($post->ID) › Reply To: Easier way $_POST['acf'] with get_fields($post->ID)
The problem with seeing them in the browser is that it will interrupt the process.
For example, you can output to the browser like this
echo '$_POST['acf'] = <pre>'; print_r($_POST['acf']); echo '</pre>'; echo 'get_fields() = <pre>'; print_r(get_fields($post_ID)); echo '</pre>';
This code will cause a “Headers already sent” error when WP tries to redirect to the admin page after saving. However, for debugging, this is generally what I do. I’m expecting the error and I want to interrupt the process so I can see what’s going on.
You can also use the debug log. This will output values to the error log and then you can open the log to see what’s in it.
error_log(implode(', ', $_POST['acf'])); error_log(implode(', ', get_fields($post_ID));
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.