Support

Account

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));