Skip to content

Instantly share code, notes, and snippets.

@reanim8ed
Last active September 15, 2021 20:33
Show Gist options
  • Save reanim8ed/bc419089fd527eb7a97a20914852f9a7 to your computer and use it in GitHub Desktop.
Save reanim8ed/bc419089fd527eb7a97a20914852f9a7 to your computer and use it in GitHub Desktop.
[WP debug] #wordpress
  • In order to enable debugging, prevent errors and warnings from being displayed and log errors, you need these three lines in your wp-config:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
  • Writing Other Information To The Log
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 );
      }
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment