forked from DevinVinson/WordPress-Plugin-Boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
WordPress log
Moisés Barrachina Planelles edited this page Oct 4, 2023
·
2 revisions
The log in WordPress is activated in wp-config.php, change:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
Now you can check the log in wp-content/debug.log
For printing to the log you can use the WordPress function error_log($string_or_number), but with Backend Frontend Template you can use: $this->debug_log_write($whatever)
$this->debug_log_write() it's a better option because it shows:
'NULL' if its a NULL variable
'TRUE' and 'FALSE' if it's a boolean
print_r() if it's an array or object
Now you can print in the log whatever variable you want
Also BFT offers an alternative name for debug_log_write: $this->write_log()