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.
Caution: Get Backup Of Your Site
Below are some errors and their solutions which we face in the development of WordPress site:
To solve this, we can put some
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.
- 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.
- 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.
- 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.
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.
- .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.
- 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.
- 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.
- 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.
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’.
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.
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.
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.
Thanks for reading
Share via social media