How to Debug WordPress® with cPanel and WordPress Toolkit?

This article provides a step-by-step explanation on how to quickly and easily debug your WordPress site using the WordPress Toolkit in cPanel. The WordPress Toolkit provides a convenient, easy-to-use interface in cPanel that you can use to set up and manage WordPress websites.

WordPress’s greatest asset is that it simply works, the average user has little or nothing to worry about. As with any complex software, there are bugs in WordPress’s code, plugins, themes and features that could cause unexpected errors. Although WordPress has debugging tools to troubleshoot these issues but using them can be cumbersome and time-consuming.

When facing issues on a WordPress site, enabling and configuring debug mode may be helpful. WordPress toolkit allows you to check your site’s security and fix issues from one interface. CPanel's WordPress toolkit makes debugging easier and faster by providing an intuitive interface for identifying errors.

WordPress debug mode instructs the software to log error messages and warnings generated by the underlying PHP code. Error logs help developers determine the cause of unexpected behaviour. Logs reveal information about the internal state of WordPress that should be kept private. Debug mode, by default, prints errors on WordPress HTML pages, but you can change this behaviour in the configuration settings.

What do these options do?

WP DEBUG: It enables and disables debugging. Debugging is usually disabled because it consumes server resources and poses a security threat
WP_DEBUG_LOG: When enabled, WordPress writes error messages to a file called debug.log, located in the wp-content directory of the site
WP DEBUG DISPLAY: Checks whether error messages are displayed on WordPress pages or not.
When debugging a staging or development site, it is useful to show an error message where they are generated; however, when debugging a production site, disable this option and use the debug log instead
SCRIPT DEBUG: This option instructs WordPress to use unminified CSS and JavaScript files to find bugs in front-end code.
SAVEQUERIES: This option saves database queries to a PHP array, which can be viewed on a page or accessed in code. Do not forget to turn off this option after debugging because enabling it can severely degrade your site’s performance.

Follow these steps to debug WordPress with WordPress Toolkit

  • Log in to cPanel. Please see this article if you do not know how to log into your cPanel
  • cPanel ->> Domains - WordPress Toolkit icon
  • Open WordPress Toolkit: This page opens with a list of installed WordPress sites.
  • From the WordPress Toolkit page, Select a site in the WordPress Toolkit interface and click on the Debug option in the Tools section to enable debug mode.
  • Under a site listing header, under Status, click Check Security.
  • After choosing debugging options, click the OK button
  • The scanning of your website begins, and WordPress will start logging errors. If you have WP DEBUG LOG enabled, you can view errors logged in the file manager by navigating to your WordPress site's wp-content directory and opening debug.log.The toolkit displays a list of issues and suggests improvements once the scan is complete
  • Check the box next to the issue, and then click Secure.

These issues can be fixed manually and resolved automatically if you have WordPress Toolkit Deluxe. To check for the integrity of WordPress application files and confirm it has not been tampered with click Verify Checksums.

The steps below provide you with a list of debugging options using the WordPress Toolkit

Identifying Bad WordPress Plugins

Non-developers can have a hard time reading PHP error logs, and there are easier options if you just want to identify and disable a badly behaving plugin. Faulty plugins can be identified through a process of elimination, which involves disabling plugins one by one until the problem is resolved, deciding the plugins that are faulty and uninstalling them.

  • In the WordPress Toolkit interface, select a site
  • Click on the Plugins tab.
  • The plugins table contains an option that activates and deactivates individual plugins.
  • Deactivate the plugins one by one and check if the issue is resolved.
  • Once the culprit is found, check the box next to the plugin and click the remove button to uninstall

Enable Maintenance Mode with WordPress Toolkit

Debugging mode is not recommended on a production website, it should only be used on staging and testing sites. If you find a bug on a live site that affects user experience, you can combine debug and maintenance modes. Maintenance mode displays a static page to notify users that a site is unavailable. When you update plugins and themes, WordPress automatically places the site in maintenance mode, but you can disable it using the WordPress Toolkit.

  • Open WordPress Toolkit
  • Navigate to the site you want to debug.
  • Click the switch in the lower right corner of the interface to enable maintenance mode.
  • Click the adjacent configuration icon to configure the maintenance mode page
  • Make your changes, and then click the preview button to make sure everything is in order.

Restoring WordPress Backups with WordPress Toolkit

The fastest way to fix a damaged WordPress site is to restore from a backup made before the bug appeared. WordPress Toolkit's backup and restore interface makes it easy to restore your site to an earlier point.

  • Launch the backup/restore tool for the site you want to repair.
  • Select a recent backup from the list
  • Click the restore button.

Restoring reverses changes made to the site after the backup was created, so it's best to create a new backup before making any changes. As you can see, the backup/restore tool makes backup and restore easy.

WordPress Toolkit in cPanel makes it easy to install, manage, and debug any number of WordPress sites, allowing WordPress hosts to provide a better user experience while keeping support costs under control.