of finding and fixing software coding erros. Debugging PHP code is part of any project. But, WordPress comes with specific debug systems designed to simplify the process as well as standardize code across the core, plugins and themes. It is not mandatory but highly recommended that plugin and theme developers use WP_DEBUG mode while working on code they plan to release publicly.
Database name, Username and Password. (case sensitive) Check hostname. Usually its “localhost” but it can be different when you are using Remote Database or some other servers. i.e. Windows Server. Database user must have sufficient permissions for same database. Sometimes Database server could be unresponsive or not working. You can check with Hosting provider. Error establishing a database connection
plugin can be incompatible with the current WordPress version. Disable Plugin/s one by one using FTP or File Manager in CPanel. First try to rename plugins directory to plugins_test or whatever you like. If you can see your website, then it must be plugin issue. Now you need to rename plugin (ex. contact-form-7 to contact-form-7_old) one by one and see which plugin is causing issue. The White Screen of Death #WSOD
plugin did not help try to disable your theme. To disable theme rename theme’s folder (ex. mytheme to mytheme_old) using FTP or File Manager in CPanel. Then activate Default WordPress theme like twentyseventeen. If you can see issue gone, then it must be theme issue. It can caused by updating theme, adding wrong code snippets in theme files. Try to remove that code and upload original files using FTP. Also issue can caused by poor coding in theme by theme author. You can ask for support to forum or theme author. The White Screen of Death #WSOD
If you have updated WordPress version and it may be not compatible with theme. Try to upload recent version WordPress core files using FTP. You can find versions archives here. https://wordpress.org/download/release-archive/ The White Screen of Death #WSOD
on website, you can use the WordPress debug function to see which type of errors are causing issue. Add the following code to wp-config.php error_reporting(E_ALL); ini_set('display_errors', 1); define( 'WP_DEBUG', true); Once you add this, the white screen will show the error, warning or notices. These can help you to find out the root cause. The White Screen of Death #WSOD
permanent global variable) that can be used to trigger the "debug" mode throughout WordPress. Default is False. This is usually set to true in the wp-config.php file on development site. define( 'WP_DEBUG', true ); define( 'WP_DEBUG', false ); Don’t use apostrophes (‘) because they will return true. Enabling WP_DEBUG will cause all PHP errors, notices and warnings displayed. Advanced Debugging in WordPress
Default false. You can enable it by adding below code to wp-config.php define( 'WP_DEBUG_LOG', true ); That causes all errors to also be saved to degug.log file inside /wp-content/ directory. It uses PHP’s built in error_log() function. This is really helpful to review all errors later. (ex. Debugging for Ajax) Note: for WP_DEBUG_LOG to do anything, WP_DEBUG must be enabled (true). WP_DEBUG_LOG
WP_DEBUG. Default true. You can disable it by adding below code to wp-config.php define( 'WP_DEBUG_DISPLAY', false ); This controls whether debug messages are shown inside the HTML of pages or not. The default is 'true' which shows errors and warnings as they are generated. WP_DEBUG_DISPLAY
will force WordPress to use the "dev" versions of core CSS and JavaScript files rather than the minified versions that are normally loaded. This is useful when you are testing modifications to any built-in .js or .css files. Default is false. You can enable it by adding below code to wp-config.php define('SCRIPT_DEBUG', true ); SCRIPT_DEBUG
queries to an array and that array can be displayed to help analyze those queries. The constant defined as true causes each query to be saved, how long that query took to execute, and what function called it. define( 'SAVEQUERIES', true ); The array is stored in the global $wpdb->queries. NOTE: This will have a performance impact on your site, so make sure to turn this off when you aren't debugging. SAVEQUERIES
'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', true ); // Disable display of errors and warnings define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); // Use dev versions of core JS and CSS files (only needed if you are modifying these core files) define( 'SCRIPT_DEBUG', true ); NOTE: You must insert this BEFORE /* That's all, stop editing! Happy blogging. */ in the wp- config.php file Example wp-config.php for Debugging
WordPress that show more information about the internals, either for a specific component or in general. Here are some examples: Query Monitor (https://wordpress.org/plugins/query-monitor/) Debug Bar (https://wordpress.org/plugins/debug-bar/) Log Deprecated Notices (https://wordpress.org/plugins/log-deprecated- notices/) Debugging Plugins
to edit your PHP.inifile, update your memory_limit in PHP.ini by modifying the below line. memory_limit = 64M; Add the script below to your .htaccess file. php_value memory_limit 64M Add the script below to your wp-config.php file define('WP_MEMORY_LIMIT', '64M'); Still problem, Contact Hosting Provider. Fatal error: Allowed memory size exhausted
at root directory. You can rename htaccess file using FTP. And then check site. Increasing PHP Memory limit. Deactivating Plugins and Themes. Re-uploading core files. If nothing works, ask support from hosting provider. Internal Server Error
add code snippets and you missed something or code has incorrect syntax. The error message will indicate what is issue and where it is located. Most of time missing brackets or unexpected character. Try to remove code using ftp or replace with original file. Parse Error
something wrong with rewrite rules. Go to Setting -> Permalinks and Update Settings. Do the same, when you are adding new custom post types. 404 – Page not found
a file. First Check wp-config.php Remove all white space before <?php and after ?> using FTP. This issue can be occurred due to other files too. So you need to make changes as per the error message and located file. To bypass this issue, Add below code to functions.php function app_output_buffer() { ob_start(); } add_action('init', 'app_output_buffer'); Cannot modify header information
Plugin or Theme or WordPress Update. Go to Root directory using FTP or File manager and delete .maintenance file. Briefly unavailable for scheduled maintenance
If you don’t want comment on your site, go to Setting -> Discussion and disable comments on new articles. Also for old posts using bulk edit you can disable comments. If you want to use comments, then use secure plugin to prevent spam comments like Akismet, Google Captcha on Comment form. Also you can use another comments plugins like Disqus, Facebook Comments etc. Too many spam comments
to uploads folder. You can change permissions using FTP (ex. FileZilla) Set 755 for folders, and 644 for files. Also, Another issue can be not enough space on hosting server, to increase space contact hosting provider. Unable to Upload images
people. Causes due to you made manual changes to your template files such as the style.css file (usually). Then when you updated everything got overwritten with the default theme code. Use Custom CSS Plugin – To add Custom CSS to your theme. Use or create a Child theme. Keep a Changelog. All changes are gone after updating theme!