Disable Debug Log Programmatically

@Wyck was right, ( well sorta 😛 ) you can set error logs but 1) You need to enable debugging 2) ini_set(‘log_errors’, 1); or 0 for false 3) You need to set a log location via ini_set(‘error_log, $location) Once you have that set you can then if need be test if said file exists via … Read more

How can I determine what php files are being called by a given WP page?

There’s a native PHP function get_included_files() for that. Simply attach it to an action on the hook from where you want to know it. The first one is muplugins_loaded and the last accessible on is shutdown. add_action( ‘muplugins_loaded’, function() { $files = get_included_files(); foreach ( $files as $f ) echo $f.'<br>’; // or… var_dump( $files … Read more

How to make debug.log timestamps local time?

What is the time zone setup in your admin -> settings -> general page? WordPress overrides & kind of disregards php’s timezone & uses this own settings , if haven’t set this – default is UTC+0 Update: according to https://core.trac.wordpress.org/ticket/39595 – wordpress has forced this to be UTC

Nginx – Prevent Access to Debug file [closed]

I’ve frequently seen this used in Apache 2.2: <Files “debug.log”> Order allow,deny Deny from all </Files> but that’s deprecated in Apache 2.4: The Allow, Deny, and Order directives, provided by mod_access_compat, are deprecated and will go away in a future version. You should avoid using them, and avoid outdated tutorials recommending their use. I just … Read more

Easy code troubleshooting in wordpress

The best way to troubleshoot/debug your PHP code for WordPress is to use the XDEBUG debugger for PHP coupled with an IDE/editor that can leverage XDEBUG. By far my favorite IDE for PHP/XDEBUG is PhpStorm (best money I have ever spent), but you can use for free on the bleeding edge with their EAP (Early … Read more