Debugging WordPress With error_log()

[ad_1]

If Debug logging is enabled, simply use the error_log() function and it will be written to /wp-content/debug.log . Refer this article to see how it can be done:

Enable Debug Logging In WordPress

You can also write the error_log to a file. WP_DEBUG need not be set to true.

error_log("\n[Timestamp - " . time() . "] " . print_r($settings,true), 3, ABSPATH . "/my_error_log.log");

Using var_dump() instead of error_log(): Writing to the PHP error_log with var_dump & print_r

[ad_2]

PROMEX · YOUR ACCOUNT

Login / Register

Use your WhatsApp number. We’ll send you a code to sign in securely.

Your code expires in 5 minutes. Never share it with anyone.