Quantcast
Channel: InstaWP
Viewing all articles
Browse latest Browse all 998

How to Get Over WordPress Troubleshooting Woes: Tools and Tips

$
0
0

If you’ve ever found yourself staring at an error 500 page, wondering why your site is not working all of a sudden, you’re not alone. Troubleshooting WordPress is something that all developers or site owners deal with. Faulty plugins, wrong configuration, or misbehaving code – anyone can be the culprit behind those error popups. 

How will you figure it out without wasting the next 4 work hours wondering what just happened? Well, we have a solution.

We’ll walk you through straightforward solutions, nifty tools, and expert techniques in this long no-nonsense guide to conquering WordPress troubleshooting. So grab a cup of coffee and learn how to turn those WordPress woes into victories.

WordPress Troubleshooting Basics

Right, let’s begin with the basics of WordPress troubleshooting. Debugging is the first thing you should do, isn’t it?

  1. Enable WP_DEBUG and WP_DEBUG_LOG

Your WordPress site is configured to show fatal errors in order to ensure a flawless experience for your visitors. But for troubleshooting, you must enter the debug mode.

For this, enable WP_DEBUG in your wp-config.php file to turn on debug mode. This setting will display PHP errors and warnings right on your screen, giving you immediate feedback on what’s going wrong.

You should also enable WP_DEBUG_LOG and direct those errors to a log file. This log is your breadcrumb trail, showing you exactly what’s happening behind the scenes and making it easier to track down the issue.

Add these lines to your wp.config.php file using a WordPress code editor:

define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);

Enable WP_DEBUG and WP_DEBUG_LOG
  1. Access Error Logs

These logs are crucial—they provide the lowdown on what’s breaking and why. 

Check both the error logs and access logs from your hosting environment. The error logs will tell you what went wrong, while access logs show who was interacting with your site when the issue occurred. Having access to both lets you piece together a complete picture of the problem.

Where to find Error Logs?

You can find them in your hosting dashboard of cPanel under the name “Logs” or “Error Logs.” Alternatively, if you have enabled the debug mode, you can download the file “debug.log” from the /wp-content/ directory.

InstaWP users can simply access the Logs Viewer for their sites via Tools > View Logs. You will find that these logs are categorized for clarity (Error Log, Access Log, Command Log, and Debug Log).

  1. Create a Staging Copy

Error log, found in the previous step, may have given you some hints related to WordPress errors on your website. However, don’t act rashly yet

Before you make any changes, set up a staging site. This is a clone of your live environment where you can test fixes and troubleshoot without risking your live site. 

By working on a staging copy, you can experiment with changes, identify and fix issues, and ensure everything works smoothly before deploying updates to your live site. This approach helps prevent downtime and avoids disrupting your users’ experience.

Create a Staging Copy for hassle-free troubleshooting

Common WordPress Issues and How to Fix Them

Alright, let’s get into the nitty-gritty of WordPress troubleshooting with a few real-world scenarios. Here are the top 3 common problems and how to tackle them like a pro.

Issue 1: There Has Been a Critical Error on Your Website

This issue is so common that it doesn’t even need an explanation, agree? Let’s figure out what to do when you face this error:

Check Debug Logs

Start by checking the debug logs. 

If you’ve got WP_DEBUG and WP_DEBUG_LOG enabled (and if not, enable them promptly), head over to your /wp-content/ directory and find the debug.log file. This file is where WordPress keeps a record of errors and warnings. 

Fix the Issue

Via SFTP: Connect to your site via SFTP. Go to /wp-content/plugins/ or /wp-content/themes/, and rename the directory of the problematic plugin or theme. This will deactivate it and help you figure out if it’s the source of the issue.

Using WP CLI: Prefer command lines? Use the wp plugin deactivate <plugin-slug> –skip-plugins –skip-themes command via WP CLI. Replace <plugin-slug> with the plugin’s slug, and voilà! You’ve deactivated the troublemaker with a few keystrokes.

Using WP CLI in InstaWP

Issue 2: White Screen of Death or 500 Error Page

The White Screen of Death (WSoD) or a 500 error page can feel like your site’s way of giving you the silent treatment. Well, here’s how you can make it speak again.

Check PHP Error Logs

Look for recent error messages. They’re your breadcrumbs leading to the source of the problem.

The errors leading to Error 500 pages are often PHP-related. Access your PHP error logs, which can usually be found in your hosting control panel or via FTP. 

Fix the Error 500 Via SFTP or InstaWP Code Editor

Use SFTP to navigate your site’s files and fix issues based on the error messages. If you’re using InstaWP, leverage the Code Editor for direct edits. 

Issue 3: Slow Websites

When your website is slow, your traffic and search engine ranking will go down. A slow website can be a serious drag—both for users and for your patience. So, we are going to introduce 6 useful tools (WordPress plugins) to debug slow websites in this section.

  1. Query Monitor: Identify slow queries affecting performance.

Query Monitor is a powerful debugging tool for WordPress that helps you identify and analyze slow database queries affecting your site’s performance. By providing detailed information on query execution times, it allows you to pinpoint performance bottlenecks and optimize your database interactions effectively.

Features:

  • Detailed Query Analysis: View execution times, database calls, and query details.
  • Performance Metrics: Identify slow queries and their impact on site performance.
  • Hook and Action Insights: Monitor WP hooks and actions for better debugging.
  • Customizable Views: Filter queries by type and context for more focused troubleshooting.
Query Monitor: Identify slow queries affecting performance.
  1. Code Profiler: Locate slow plugins and their impact.

Code Profiler is a WordPress tool designed to identify slow plugins and their impact on site performance. By analyzing the execution time of various code components, it helps you detect performance issues and optimize or replace inefficient plugins.

Features:

  • Execution Time Tracking: Tells how long plugins and code segments take to run.
  • Performance Impact Reporting: Identify which plugins or functions are slowing down your site.
  • Detailed Code Analysis: Get insights into function execution and resource usage.
  • Optimization Recommendations: Receive suggestions for improving code efficiency.
Code Profiler: Locate slow plugins and their impact.
  1. AAA Options Optimizer: Find and optimize unnecessary options.

AAA Options Optimizer is a plugin that helps you find and optimize unnecessary WordPress options. Cleaning up redundant or outdated options, it streamlines your database and enhances site performance.

Features:

  • Option Cleanup: Identify and remove unnecessary database options.
  • Performance Improvement: Boost site speed by optimizing database queries.
  • User-Friendly Interface: Simple and intuitive dashboard for managing options.
  • Automatic Optimization: Schedule regular cleanups to maintain optimal performance.
wordpress troubleshooting,debug wordpress,wordpress errors
  1. WP Cron Control: Review and manage cron entries to improve performance.

WP Cron Control provides tools to review and manage scheduled cron jobs in WordPress. By monitoring and optimizing cron entries, it helps improve site performance and ensures that scheduled tasks run efficiently.

Features:

  • Cron Job Management: View and manage scheduled cron jobs and tasks.
  • Performance Monitoring: Track the execution time and frequency of cron jobs.
  • Error Logging: Detect and troubleshoot issues with cron job execution.
  • Optimized Scheduling: Adjust and optimize cron schedules to prevent performance degradation.
WP Cron Control: Review and manage cron entries to improve performance
  1. Log HTTP Requests: Track and analyze outbound queries.

It is a tool for tracking and analyzing outbound HTTP requests made by your WordPress site. It helps diagnose issues related to external API calls and integrations that could affect site performance.

Features:

  • Request Tracking: Monitor and log all outbound HTTP requests.
  • Performance Analysis: Analyze request times and detect bottlenecks.
  • Error Reporting: Identify and troubleshoot issues with external connections.
  • Detailed Logs: Access detailed information about each request, including URL and response status.
Log HTTP Requests: Track and analyze outbound queries.
  1. Asset CleanUp: Remove unused JS/CSS files that may slow down the site.

Asset CleanUp is a WordPress plugin that helps you remove unused JavaScript and CSS files from your site. By eliminating unnecessary assets, it improves page load times and overall site performance.

Features:

  • Asset Removal: Identify and delete unused JS and CSS files.
  • Performance Enhancement: Reduce page load times by cleaning up assets.
  • Selective Loading: Control which assets are loaded on specific pages.
  • User-Friendly Interface: Easy-to-use dashboard for optimizing assets.
Asset CleanUp: Remove unused JS/CSS files that may slow down the site

Common PHP & WordPress Settings for Debugging

When troubleshooting WordPress, having the right PHP and WordPress settings can make all the difference. These settings enable you to catch and address issues efficiently, ensuring your site remains functional and performant. So, when there is an issue, you must check if the value configured for these settings is correct.

  1. max_execution_time

When troubleshooting WordPress, adjusting PHP settings like max_execution_time and memory_limit can resolve common issues. The max_execution_time setting controls how long a PHP script is allowed to run before timing out. 

If you encounter errors or incomplete processes, increasing this limit can help. For instance, setting it to a bigger duration (i.e., 60 or even 300 seconds) in your php.ini file can prevent scripts from timing out during complex operations.

  1. memory_limit

The memory_limit setting determines the maximum amount of memory a PHP script can use. If your site experiences errors related to memory limits, such as the “Allowed memory size exhausted” error, increasing this limit can help. 

Adjusting memory_limit to 256M or higher in php.ini provides more resources for script execution, ensuring smoother performance and fewer memory-related issues.

These values can be easily set for your sites built with or connected to InstaWP from the PHP Config tab.

Edit max_execution_time or memory_limit from PHP Config tab in InstaWP

Essential Tools for WordPress Site Security and Management

Whether you want to check plugins/Theme conflicts or want to understand if your site’s heatlh is good, you will need WordPress troubleshooting and security tools/techniques. 

1. Use a Troubleshooting Plugin

You can choose the Health Check and Troubleshooting Plugin for this purpose.

Developed by WordPress.org, this plugin helps you troubleshoot issues by allowing you to disable all plugins and switch to a default theme for your user session. It’s a powerful tool to isolate the problem.

How to Use?

Activate the plugin and go to the Troubleshooting tab in the Site Health section. Click on “Troubleshoot” to disable all other plugins and activate only the one you want to test. 

For instance, if you’re troubleshooting Contact Form 7, you can enable it while disabling all other plugins. This isolation lets you identify if the issue is with the specific plugin or theme without affecting your site’s overall functionality. You can then re-enable plugins or themes one at a time to pinpoint the cause.

Note: If you prefer not to use plugins, you can manually deactivate all plugins and switch to a default theme from the WordPress admin dashboard. However, make sure to do so in WordPress Staging in order to preserve your site’s experience.

2. Use a Vulnerability Scanner

It scans your site for known security vulnerabilities in core files, plugins, and themes. Regular scans identify risks before they can be exploited, ensuring timely updates and fixes.

Use a Vulnerability Scanner

3. Use a Performace Monitoring Tool

You can use Page Insight for it. It is a vital tool for assessing and enhancing your website’s performance. It provides detailed reports on various aspects of your site’s speed and usability, pinpointing areas that need improvement to ensure a smoother user experience.

Use a Performace Monitoring Tool - Page Insight

4. Verify Checksums while Troubleshooting 

When a WordPress site is compromised, attackers often modify core files, plugins, or themes, which can lead to security vulnerabilities or functionality issues. Verifying checksums is a key step in identifying these unauthorized changes.

In case you don’t know – Checksums are unique values calculated from the contents of a file. They act like a digital fingerprint, allowing you to verify that a file has not been altered. WordPress provides tools to check these checksums for core files and plugins to ensure they have not been tampered with.

How to Verify Checksums?

Step 1 – Run the command wp core verify-checksums to check core files.

This command verifies the integrity of WordPress core files. If a core file has been modified, the command will show discrepancies between your file’s checksum and the expected checksum from the WordPress repository.

Running wp core verify-checksums might reveal errors if files like wp-activate.php have been tampered with. You can then manually review or restore these files to their original state.

Step 2 – Run the command wp plugin verify-checksums –all to check plugins.

As you can guess, it compares the checksums of your plugin files against the expected values from the plugin’s original source.

Note: This method may not cover third-party or premium plugins. For these, you may need to manually compare files or use additional tools.

Step 3 – Manual Verification

If the automated tools don’t cover certain plugins or themes, you can manually download fresh copies from the WordPress repository or vendor and compare their checksums with those on your server.

  • Download the latest version of the plugin or theme.
  • Compute the checksum of the downloaded files using tools like md5sum or sha256sum.
  • Compare these checksums with those on your server.

WP CLI Cheatsheet for quick WordPress Troubleshooting

When managing a WordPress site, WP CLI can be an invaluable tool for handling various administrative tasks efficiently. Whether you need to clean up spam comments, perform bulk updates, or manage maintenance modes, WP CLI commands allow you to execute these actions swiftly through the command line. 

Here’s a quick table of some essential WP CLI commands that you might find helpful for different scenarios:

TaskWP CLI CommandDescription
Delete Spam Commentswp comment delete –spamRemoves all comments marked as spam.
Search and Replace a Stringwp search-replace ‘old-string’ ‘new-string’Updates old strings to new strings in the database.
Activate Maintenance Modewp maintenance-mode activateActivates maintenance mode on live sites.
Delete Inactive Pluginswp plugin delete $(wp plugin list –status=inactive –field=name)Deletes all plugins that are currently inactive.
Delete Revisionswp post delete $(wp post list –post_type=revision –format=ids) –forcePermanently deletes all post revisions.
Update Core, Plugins, and Themeswp core update <br> wp plugin update –all <br> wp theme update –allUpdates WordPress core, all plugins, and all themes.
Deactivate All Pluginswp plugin deactivate –allDeactivates all plugins on the site.

Useful WP CLI Packages

  1. wp doctor check –all

When You Need It: Use this package when you suspect underlying issues with your WordPress setup but aren’t sure where to start.

How to Use: Run wp doctor check –all to execute a series of diagnostic checks that cover common symptoms and issues. This will help you pinpoint potential problems and guide your troubleshooting efforts.

  1. wp profile stage –all

When You Need It: Ideal for when your site is running slow, and you need to identify performance bottlenecks.

How to Use: Execute wp profile stage –all to analyze and pinpoint what’s slowing down your WordPress site. This command provides detailed performance metrics, helping you optimize the slowest components.

  1. wp code-profiler run

When You Need It: Use this package when you suspect that slow plugins or inefficient code are affecting site performance.

How to Use: Run wp code-profiler run to profile your WordPress site’s code and identify slow plugins and functions. This tool offers insights into code execution times, enabling you to target and optimize problematic areas.

Note: If you are using InstaWP, you can simply save these WP CLI Commands in your dashboards and run them for all your WordPress websites as and when you want.

WordPress Troubleshooting with InstaWP

Remember, the key to mastering WordPress troubleshooting is practice and familiarity with these essential tools and commands. And InstaWP has all the tools and techniques to well-equip you for troubleshooting WordPress issues efficiently and effectively. 

Though we have covered most of these tools, here’s a quick summary:

  1. WordPress Staging Tool: Duplicate your live environment for testing.
  2. Command Library: Add and manage custom WP CLI commands.
  3. Configurations: Set default WordPress options and plugins.
  4. Versions: Rollback changes with snapshots.
  5. PHP Settings: Manage PHP configurations for debugging.
  6. Code Editor: Edit code directly from InstaWP.
  7. Logs Viewer: Access and review logs.
  8. DB Editor: Manage your database with Adminer.
  9. SFTP & SSH Access: Access and manage files and server directly.

Ultimate Troubleshooting Toolkit for WordPress Agencies! 

FAQs (WordPress Troubleshooting)

  1. What should I do if I encounter a “There has been a critical error on your website” message?

Check debug logs for details. Deactivate plugins/themes via SFTP or use WP CLI: wp plugin deactivate <plugin-slug> –skip-plugins –skip-themes to isolate the issue.

  1. How can I resolve the White Screen of Death or a 500 Error Page?

Review PHP error logs for issues. Use SFTP or InstaWP Code Editor to fix the code based on the error messages.

  1. How can I troubleshoot slow WordPress websites?

Use tools like Query Monitor, Code Profiler, AAA Options Optimizer, WP Cron Control, Log HTTP Requests, and Asset Cleaner to identify and address performance issues. Make sure that you make changes to your site in a staging environment like InstaWP before actually pushing them to your live site.

  1. What are the steps to perform a search and replace operation after a WordPress migration?

Use the command wp search-replace ‘old-string’ ‘new-string’ to update strings in your database after migration.

  1. How can I activate maintenance mode on a WordPress site using WP CLI?

Use the command wp maintenance-mode activate to show a maintenance message to visitors during updates.

  1. How can I delete WordPress plugins and themes from a site with WP CLI?

Use commands like wp plugin delete $(wp plugin list –status=inactive –field=name), wp post delete $(wp post list –post_type=revision –format=ids) –force, wp core update, wp plugin update –all, wp theme update –all, and wp plugin deactivate –all for efficient management.


Viewing all articles
Browse latest Browse all 998

Trending Articles