User Tools

Site Tools


How to Debug WordPress


  define('WP_DEBUG', false);

Debug mode gives some troubleshooting information that you don't want to see all the time, unless you're troubleshooting an issue. When that's the case, change false to true, clear cache, refresh the page that's a problem and observe the information. After you fix the problem, remember to change it back again.

Debug output can be logged, allowing you to peruse it later. You'll need WP_DEBUG to be true. If you set WP_DEBUG_LOG true, you'll find the debug log written to a file in wp- content/debug.log.

  define( 'WP_DEBUG_LOG', true );

Alternatively, you can specify a different location:

  define( 'WP_DEBUG_LOG', '/somefolder/wp-errors.log' );

If you'd like to log debug output to a file and not have it shown on your WordPress html site, you can keep logging turned on, but turn off just the debug display. In this case, false means no echoing of errors to the site visitors browsers.

  define( 'WP_DEBUG_DISPLAY', false );


When your diagnosing database query issues or performance, one way to do it is to set:

  define( 'SAVEQUERIES', true );

It'll store each query, the function calling it and how long it took to execute. It'll slow your performance, so don't leave it true for longer than is necessary.

You'll find all this information stored in



By default, WordPress uses minified versions of .css and .js files. If you'd like to use the dev versions, which are much more readable, set SCRIPT_DEBUG true.

  define( 'SCRIPT_DEBUG', true );


  /** Absolute path to the WordPress directory. */
  if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

  /** Sets up WordPress vars and included files. */
  require_once(ABSPATH . 'wp-settings.php');

The above enables WordPress to find the file and folder where wp-settings.php is located.

wp-config.php Example

  * Custom WordPress configurations on "wp-config.php" file.
  * This file has the following configurations: MySQL settings, Table Prefix, Secret Keys,
  WordPress Language, ABSPATH and more.
  * For more information visit {@link Editing
  wp-config.php} Codex page.
  * Created using {@link wp-config.php File Generator} on
  * @package WordPress
  * @generator

  /* MySQL settings */
  define( 'DB_NAME', 'mywp_dbname' );
  define( 'DB_USER', 'mywp_dbuser' );
  define( 'DB_PASSWORD', '£$!%RVAVERqeasf' );
  define( 'DB_HOST', 'localhost' );
  define( 'DB_CHARSET', 'utf8mb4' );

  /* MySQL database table prefix. */
  $table_prefix = 'mywp_';

  /* Authentication Unique Keys and Salts. */
  define('SECURE_AUTH_KEY', 'Xz=S4S]@12TiPYE;5S*b_,@$`c:NE_M65F:(@#)3');
  define('LOGGED_IN_KEY', 'FVf-Zz&YtGiQ}_U|:pqO@fT28{DN@LN5@Q1Z/Xs|H0+i%hg5h(VjO?aWfjNtI8p');
  define('NONCE_KEY','B|lch@DQ-4}y>H-Nc=D/4eziImu)^1>M&q0^{e %vfsI)sh+HHkW-zjC{E& fU+a');
  define('AUTH_SALT','*zec]V/aAT!YM ;|eQG&jXwO{U!u?[IBv8qw-*t*_/Eg^1N/OY,POw=|;B_RT3vb');
  define('SECURE_AUTH_SALT', 'Q[iZ%Pj-DTb4t2T9$M/[F/X[}v?iy-azG9CF -,ziTT;T]zq2q#7u8Q/i}NY|U|u');

  /* Custom WordPress URL. */
  define( 'WP_SITEURL', '' );
  define( 'WP_HOME','' );

  /* Specify maximum number of Revisions. */
  define( 'WP_POST_REVISIONS', '5' );

  /* Trash Days. */
  define( 'EMPTY_TRASH_DAYS', '7' );

  /* Multisite. */
  define( 'WP_ALLOW_MULTISITE', false );

  /* WordPress debug mode for developers. */
  define( 'WP_DEBUG',true );
  define( 'WP_DEBUG_LOG', true );
  define( 'WP_DEBUG_DISPLAY', false );
  define( 'SCRIPT_DEBUG', true );
  define( 'SAVEQUERIES',true );

  /* PHP Memory */
  define( 'WP_MEMORY_LIMIT', '128M' );
  define( 'WP_MAX_MEMORY_LIMIT', '512M' );

  /* WordPress Cache */
  define( 'WP_CACHE', true );

  /* Compression */
  define( 'COMPRESS_CSS',true );
  define( 'COMPRESS_SCRIPTS', true );
  define( 'CONCATENATE_SCRIPTS', false );
  define( 'ENFORCE_GZIP',true );

  /* FTP */
  define( 'FTP_USER', 'mywpftpuser' );
  define( 'FTP_PASS', '!$RE¬\"$vasfd' );
  define( 'FTP_HOST', '' );
  define( 'FTP_SSL', true );/* CRON */
  define( 'DISABLE_WP_CRON','false' );
  define( 'ALTERNATE_WP_CRON', 'true' );
  define( 'WP_CRON_LOCK_TIMEOUT', 30 );

  /* Updates */
  define( 'WP_AUTO_UPDATE_CORE', true );
  define( 'DISALLOW_FILE_MODS', false );
  define( 'DISALLOW_FILE_EDIT', false );

  /* Absolute path to the WordPress directory. */
  if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

  /* Sets up WordPress vars and included files. */
  require_once(ABSPATH . 'wp-settings.php');
resources/wordpress-debug-troubleshooting-wiki.txt · Last modified: 2020/06/11 09:31 by Karson N.