Skip to content

WordPress log

Moisés Barrachina Planelles edited this page Sep 19, 2023 · 2 revisions

The log in WordPress is activated on wp-config.php, change:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
Now you can check the log on wp-content/debug.log

For printing on 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 on the log whatever variable you want

Also BFT offers an alternative name for debug_log_write: $this->write_log()
Clone this wiki locally