Yes, add this function to your module
function my_print_r( $msg, $name="" )
{
$error_dir="/path/to/wordpress/wp-content/debug.log";
$msg = print_r( $msg, true );
$log = $name . " | " . $msg . "\n";
error_log( $log, 3, $error_dir );
}
And call my_print_r( $variable_to_inspect, 'description' );
. The file debug.log
is originally used by WP_DEBUG_LOG
, and if you don’t have it enabled only your debug info will be there. This plugin of mine shows the content of that file in the dashboard.