Categories
Tutorials

The most common errors in WordPress and troubleshooting

WordPress like any programmed application may have many bugs or errors due to the usage of the customers. So due to the large community of WordPress and the long period of the WordPress in the market, its errors became more known and their troubleshooting became easier. So in this article, we hop to make it easier to fix any error in your WordPress website without a lot of hassle.

The White Screen of Death

Don’t panic, it’s not the big deal. Both PHP errors and database errors can cause as a white screen, a blank screen with no information, and it’s commonly known in the WordPress community as the WordPress White Screen of Death (WSOD).

You can troubleshoot this error by many ways:

1.Deactivate all plugins

This problem may be caused because of the incompatibility of plugins with WordPress or with each other. If you can access the Administration Screens try deactivating all of your Plugins and then reactivating them one by one.

If you are unable to access your Screens, log in to your website via any FTP application. Locate the folder wp-content/plugins and rename the Plugin folder plugins_old. This will deactivate all of your Plugins. Then check the administration screens again to activate them one by one until reaching the problem plugin.

2.Theme incompatibility

Log in to the Administration Screens and activate the default WordPress Twenty Sixteen Theme. If you can’t access your Administration Screens, access your website via FTP application and navigate to the /wp-content/themes/ folder. Rename the folder for the active Theme “Twenty Sixteen Theme”.

3.Your Theme directory may be missing or renamed

This is common for developers who have just created a local development environment and cloned the database, which is pointing to a theme that might be missing or renamed. To test this solution, try accessing wp-login.php or /wp-admin/. If you see anything, this is a good indication it’s theme-related. Log in as an administrator, then try to view the front-end and you should see a WordPress error message to the effect of: The theme directory “{theme-name}” does not exist. You can solve this in any number of ways, including switching themes on the admin side, renaming your directory, or editing the “theme” and “stylesheet” records in wp_options.

Internal Server Error

There are many sources for errors in the server and the common like the following.

internal_server_error

1.changing htaccess file

The error may be because of the htaccess file corruption. you need to log in to your site root using FTP application. Then search for the .htaccess file and rename it to .htaccess_old. After ensuring this step reload the site to see if the problem has been solved. If it works, make sure to reset your permalinks to generate new .htaccess file for you. If not, please continue to the second step.

2. Plugins deactivation

Like we told before, plugins may cause problems due to the incompatibility. So may the problem in the server because of a plugin or actions of activated plugins. You need to be sure about the plugins. So deactivate all of them. If you are unable to access your WordPress Administration Screens, deactivate your Plugins via FTP. After logging in to your website via FTP application, locate the folder wp-content/plugins and rename the Plugin folder plugins_old. This will deactivate all of your Plugins. Then check the administration screens again to activate them one by one until reaching the problem plugin.

3. Theme incompatibility

Log in to the Administration Screens and activate the default WordPress Twenty Sixteen Theme. If you can’t access your Administration Screens, access your website via FTP application and navigate to the /wp-content/themes/ folder. Rename the folder for the active Theme “Twenty Sixteen Theme”.

4. Increasing memory allocated to PHP

The WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as “Allowed memory size of xxx bytes exhausted”. Or when there is a problem inside the server and you try to troubleshoot what happened.

This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase memory allocated to PHP to 40MB (code is at the beginning of /wp-includes/default-constants.php) for single site and 64MB for multisite, so the setting in wp-config.php should reflect something higher than 40MB or 64MB depending on your setup.

WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there is no need to set this value to 64M as WordPress will automatically use all 64MB if need.

Please note, this setting may not work if your host does not allow for increasing the PHP memory limited in that event, contact your host to increase the PHP memory limit. Also, note that many hosts set the PHP limit at 8MB.

define( ‘WP_MEMORY_LIMIT’, ’64M’ );

The number must be a result of exp(2, any number).

5. Refresh WordPress copy

If the above steps didn’t work, you need to replace the files in database by new ones from a new WordPress copy. You need to find the source WordPress file on your computer and get wp-admin and wp-includes folders and upload them on the website instead of the old ones.

Error Establishing Database Connection

You may get a page featuring the message “Error Establishing Database Connection,” this means that there is a problem with the connection to your database and there could be a number of reasons for this as follows:

1.Incorrect wp-config.php Information

The reason usually caused by an error in your wp-config.php file. You need to log in to your website using FTP application. Open up wp-config.php and ensure that the following are correct:

  • Database name.
  • Database username.
  • Database password.
  • Database host.

If you are sure your configuration is correct you could try resetting your MySQL password manually.

2. Problems with Your Web Host

The problem may be the web hosting service. The following hosting issues may be causing the problem:

  • Your database has met its quota and has been shut down.
  • The server is down.

In this case, you need to contact the hosting service company and make sure that everything is fine with them.

3. Hacking

If the above points are working fine and the problem still up, unfortunately, your website may be hacked. You need to use one of the security plugins to make sure about this point.

4. After updating

In some cases, WordPress auto-update feature may fail. Symptoms include:

  • A blank white screen and no information.
  • A warning that the update failed.
  • A PHP error message.

The WordPress automatic upgrade feature may fail due to a glitch in the connection with the main WordPress files, a problem with your Internet connection during upgrade, or incorrect File Permissions.

In this case, you need to upload the backup version that you stored and then try to update manually.

You Make Changes and Nothing Happens

If you followed all the previous steps, and nothing changed. You may need to clear your cache in the browser. Your browser stores information about the websites that you visit to make it faster to load when you visit it again. So the browser just has to reload information already stored on your computer, rather than downloading the new about our website executed in previous steps.

When you clear the browser cache, the browser will simply load the new information again  so the problem will be fixed.

Pretty Permalinks 404 and Images not Working

If you experienced this error, or white screen after loading the page. You may need to reset your permalinks or you may need to you may have to edit the .htaccess file manually.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If you are not familiar with editing your .htaccess file, contact your hosting provider to ask them to turn on mod_rewrite rules.

When you are locked out the admin area

You may find yourself locked out the admin area and can’t go through for your Website. We will guide you to solve such problem.

1.Access the Database via phpMyAdmin

phpmyadmin_to_access_database_and_troubleshooting

This step can help you to reset your password from the database, if you forget it. You can use phpMyAdmin program as we explained before in this article. Once you logged in to your database, find the wp_users table. Note, the name might be different in case you changed your database prefix during installation, however, it should still end in _users. In this table, you can find a list of the all users of the website. You need to click on this table to open it. You can find your user name and a link about “Edit” beside it. To create a new password, just delete what is in there and write down your new password. But before hitting Save at the bottom, make sure you pick <<MD5>> from the drop-down menu named Function in the middle.

So you can check now if you can log in to the website or not.

2. Sign in with wrong details many times

This is due to your security plugin. So you need to search for about solving this problem by your security plugin name or contacting its customer support. Because, each plugin deal in different ways with such case and your database.

If you can’t find a solution for your security plugin, simply you can disable it. But we recommend that this solution will be your last resort. For that, establish a connection to your FTP server and access your plugins folder inside “wp-content”.

Once there, you can deactivate your security plugin by renaming its directory. After that, it’s time to try if you are still locked out of WordPress. If you have access again, make sure to take steps to prevent this from happening again as mentioned above.

Troubleshooting Syntax error in WordPress

This error may occur when you are trying to add new snippet in your WordPress and you have missed some code or write a line or order in wrong way so the whole process through the code will crash and get

 

Parse error- syntax error, unexpected $end in /public_html/site1/wp-content/themes/my-theme/functions.php on line ….

 

To fix the syntax error, you need to correct the error in the code. You can go to the editor in the appearance part in the sidebar. Go to the last file that you edited or access the file that has the problem in the error with the number of the line then rethink about that code again.

Finally, the best solution for most of the errors is uploading the old newest backup. So it’s an important step to do to backup the whole website regularly.

Leave a Reply

Your email address will not be published. Required fields are marked *