As follows:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);Place error-logging.php in wp-content/mu-plugins folder.
Like so:
write_log( "string" );
write_log( $variable_or_array );As follows:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);Place error-logging.php in wp-content/mu-plugins folder.
Like so:
write_log( "string" );
write_log( $variable_or_array );| <?php | |
| ini_set('error_log', WP_CONTENT_DIR . '/debug.log'); | |
| ini_set('log_errors', 'On'); | |
| ini_set('display_errors', 'Off'); | |
| error_reporting(E_ERROR | E_PARSE); // Only write errors, not notices, or warnings | |
| //error_reporting(E_ERROR | E_WARNING | E_PARSE); // if you want to also display warnings | |
| if ( ! function_exists('write_log')) { | |
| function write_log ( $log ) { | |
| if ( is_array( $log ) || is_object( $log ) ) { | |
| error_log( print_r( $log, true ) ); | |
| } else { | |
| error_log( $log ); | |
| } | |
| } | |
| } |