WordPress Errors and Their Solutions

Overview

WordPress is the most loved overall CMS. Most of the Blog sites or E-Commerce sites ( i.e. WooCommerce ) are created in WordPress. It is easy to use, gives no error and runs successfully, but sometimes the user faces some hurdles. In this article, we will discuss some most common WordPress errors and their solutions that everyone faces while creating a WordPress site.

wp_image1

Caution: Get Backup Of Your Site

  • It is important to take a backup of your site before doing any kind of modification. Before you proceed to solve any kind of issues, make sure you have a backup because your site might break down while solving errors.
  • It is necessary to have a backup, so you can revert it back. You can take backup as follows:
    • Take Backup Manually: Take a backup of all your files and export your database.
    • Take Help of Plugin: You can install any plugin which helps you to take a backup of files and database.

Below are some errors and their solutions which we face in the development of WordPress site:

Disabled Javascript

Nowadays, Javascript is beloved for all developers. Javascript works fine within any WordPress site. If Javascript is disabled in any browser, it might stop running the site or it may affect the design of the site.

Solution:

    • To solve this, we can put some
      in header or footer file, which displays some informative page which indicates javascript is disabled to users and guides to enable javascript.

For ex.

  • Put this code in your header.php or footer.php
  • Create disabled_script.php file in your site, which gives the message that javascript is disabled.
  • If javascript is disabled, the site would be redirected to a specific page, saying javascript is disabled.

WordPress Asks for FTP Credentials

This error occurs when WordPress can’t access your files directly or can’t update any plugin or theme. Users are asked for credentials to edit or install files.

Solution:

  • The problem is about permission. This will allow accessing files and plugins. The below function allows to edit or install files or plugins.

Step 1: To solve this, first put below code in the wp-config.php file.
define(‘FS_METHOD’,’direct’);

Step 2: Next go to your site directory and run below command in your console. This will change the permissions of your site’s folder.
Command:- sudo chmod -R 777

  • The above steps will help you to change the permissions of your site. Now you can update any plugin or theme.

Site Not Working and Also Not Displaying Any Error (White Screen of Death)

  • If your site displays a blank screen with no information, no errors displaying, it would be the ‘White Screen of Death’. This error is caused because of some PHP errors or database errors. Following are some of the several possible reasons:
1. Plugin Compatibility Issue
  • One of the issues might be of plugins in your site.
  • Some plugins might conflict because of the bad coding structure of the plugin. It may cause an error in the WordPress site.

Solution:

  • If you can access your Administration screen, then first deactivate all your plugins on the site.
  • Activate all your plugins one-by-one to find the issue.
  • If you can’t access your Administration screen, then open your website via FTP and locate to wp-content/plugins folder and rename all plugin names.
  • Rename all your plugin one-by-one to find the issue.
2. Theme Issue
  • If all plugins are working fine and you still get the issue with a blank screen, then it may have a problem with an activated theme in your site.
  • Deactivate the theme and WordPress will activate the default theme.
  • Try to run your site, and if it runs successfully, the issue would be with your theme.

Solution:

  • To solve this check your theme’s function file.
  • Check if it contains extra spaces at the beginning or end of the file (remove space before <?php) or have a bad coded function, fix it.
  • It may cause problems and your site might not run successfully.
3. Other Issue
  • If the above-mentioned points are not the issue with your site, and still getting a blank screen in your site then enable debug mode to find the issue.
  • The issue might be of PHP code or database error.

Solution:

  • Enable debug mode in the theme’s wp-config.php file.
  • Set Debug mode to true.
  • It will display the error. The error might be some PHP error or Database error.

wp_image2

500 Internal Server Error

  • This error would occur either because of the corrupted .htaccess file, plugin compatibility issue or theme issue in your site.
  • To solve the plugin issue follow the above steps of the Plugin Compatibility Issue section.
  • If it’s not a plugin issue, it might be of theme issue then follow the steps of the Theme Issue section.
  • The issue might also be of PHP error or database error. To solve this issue enable debug mode in wp-config.php file.
  • If still getting the error then it might be of corrupted .htaccess file.

Solution:

  • .htaccess is a hidden file in your project directory.
  • To access this file, you should give permissions to access the hidden file in your client FTP.
  • Rename your .htaccess file and check if it works. If it works successfully, go to your Administrative Screen->Settings->Permalinks and click on “Save Changes”. This will generate a new .htaccess file for your site.
  • If you can’t see the .htaccess file, it would still not be created in your project. Go to your Administrative Screen->Settings->Permalinks and click on “Save Changes”. This will generate a new .htaccess file for your site.

wp_image3

Cache Clear

  • You make changes in your site and nothing happens, it might be the browser’s cache issue.
  • Clear your browser’s cache and cookies and re-run your site.
  • It will run successfully.

Broken Website (PHP Version Issue)

  • Without PHP, WordPress sites might not exist.
  • If there would be a PHP version issue, your site might stop running and it may not result as needed.
  • Currently, v7.3 or greater version of PHP is recommended for WordPress. Your website will be faster, more efficient, more secure as you have the latest PHP version. But there would be PHP version issue if your site’s PHP version isn’t compatible with the version of PHP in activated plugins or themes on your site.

Solution:

  • Before you do any kind of changes, make sure to take a backup of your site. If your site gets stuck anywhere, there will be a solution to get back your site, if you have your backup.
  • First update WordPress, Plugin, and Theme.
  • Enable debug mode to true in your wp-config.php file to display PHP errors.
  • Check version of PHP in which site is developed.

There are 2 ways to check the version:

1)By using PHP function:
<?php phpinfo(); ?>
Put this function in your theme and check the version of PHP.

2)By using plugins:
There are several plugins that check the version of the PHP of your site.

  • PHP is set on the server-side by your hosting company. Interact with your hosting company to update the version or ask them to update the version. The hosting company provides instructions to update PHP on your server.

404 Page Not Found

  • This error is the most common error for developers. This error occurs when the requested URL is not found, or when displaying any post or page.
  • This error will not display anything and return 404, but it contains the content of the page.

Solution:

    • On one side, it is again the issue of .htaccess file in your site so you can follow the steps mentioned earlier for the same. In most cases, this solution will work.
    • But if it doesn’t work then rewrite the rules in your .htaccess file located in your site where your wp-content folder is located.
    • Replace the default code with the below code in your .htaccess file.

Resolve a Custom Post Type Name vs. Page Permalink Conflict (Same Slug)

  • The issue is very small or weird but might end up badly.
  • Accidentally, if custom post type and one of the pages in your site has the same slug then WordPress might not result as per your expectations.
  • In this case, WordPress will give your custom post type’s archive page. It will not display your page’s content.
  • The reason behind this is WordPress archives have seniority than WordPress page. Yes, it’s true. That’s why if custom post type slug and page slug are the same, the output will be of the archived page, not of the original page.

Solution:

There are two solutions to these problems:
1. Disable the archive functionality of the custom post type.

  • Disable the archive page of the custom post type, that is when registering the custom post type makes ‘has_archive’ to ‘false’.

For ex.

2. Rewrite the slug of the custom post type.

  • Rewrite the slug of the custom post type, which means changing the slug in the ‘rewrite’ attribute when registering your custom post type.

For ex.

Note: When following any of the above solutions, after updating the code, do not forget to update the permalinks in Settings => Permalinks. Otherwise, you might not get the updated output and see the old one only.

Conclusion

That’s It. WordPress’s most common errors and their solutions. Those are just a few common errors that we face usually. We hope this post will be helpful to you guys for solving these WordPress problems. If you guys get some other problems and their solution or a better way to solve the above errors, share it in the comments section. Nobody wants hurdles in their site, so share your views and help them get rid of it. Besides these things, WordPress will still be the loved CMS for us.

mm

Richa Kalaria WordPress Developer

Richa Kalaria is a WordPress Developer at Yudiz Solutions Pvt. Ltd. She is interested in plugin and theme development and also doing customization in WordPress including Woocommerce. She is passionate about doing new developments in WordPress.

Leave a Reply

Top