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