I am trying to debug my save_post function and cannot get the $_POST array to print so that I can see what's being posted. Please help!

add_action ('save_post', 'save_events');

function save_events($post_id){
    if (('event' == $_POST['post_type']) && ('publish' == $_POST['post_status']) && ( $_POST['original_post_status'] != 'publish' )){ 

                       //function code...

Either add a die after that print_r() or (better) use error_log() instead of print_r() and look at your php error logs for the output.

What's happening is WordPress is reloading content before you get a chance to see the output (in most cases).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.