Debug Statements Logging In WordPress

Debug statements in WordPress can be displayed by using echo which will display the message on the page. It’s a bit of a messy way to debug but works for simple debugging purposes.  A better way to do this is to create a function to write your own debug statements to the debug.log file.

Debug Statements

Here’s a function you can use which will only logs the message if WP_DEBUG is enabled.

Then you can call the write log function like this to send a message to the debug file!

 

Leave a Reply

Your email address will not be published. Required fields are marked *