WordPress, with its use of PHP and databases, can be more complicated than HTML when addressing problems. Since the database, theme and plugins all come together, simply looking at the coded view of a page does not always reveal all the factors behind what is causing problems. However, as a workaround, virtually all WordPress problems can be fixed by following the simple steps outlined below.
Start with plugins
Whenever addressing a problem with WordPress, start by disabling all plugins and seeing if the problem goes away. As it is not uncommon for plugins to cause conflicts when WordPress is updated or in other situations, simply disabling plugins will fix the problem in a high percentage of situations.
If disabling the plugins fixes the problem, enable them one at a time until it reoccurs to find which one is the culprit. Once the culprit has been identified, try uninstalling and reinstalling the bad plugin. If it still is not working properly, the plugin is probably incompatible with the version of WordPress or the theme being used.
Disable plugins from cPanel
In situations where it is impossible to login to WordPress and disable the plugins, they can be disabled from the cPanel. Login into cPanel and then go to phpMyAdmin. After selecting the database in the upper left, find and click on wp_options (“wp” may be something different if the prefix was changed as it was to “sa” below) in the left column. Then, find the row “active plugins” (this will likely be on the second page or later) and click “Edit.” You will see something like the following:
Delete all the code on the box and click “Go.” This will simply disable all plugins, and they can easily be enabled again the next time you log in, so it is not worth the bother to look for a specific plugin.
Change the theme
Sometimes the theme is the problem. To test this, go to appearance/themes and activate another theme, preferably the WordPress default Twenty Twelve theme, and see if the problem goes away.
Fixing database problems
If neither of the above fixes things, there may be a problem with the database. Diagnosing database problems can be difficult and require the help of others. However, there is a workaround that anyone can do that is virtually certain to fix any problem.
Option A for fixing database problems: Import everything into a new database
A simple, low-tech way to fix a database problem is to create a new one and import everything into it. Apart from being something anyone can do without the need of coding knowledge, doing so creates a fresh start that should leave you with a lighter database that will run smoother and faster.
Just follow these four steps:
1. Create a safety backup
Before doing anything with the database, make sure you have a complete backup of both the cPanel database and all the files in the public_html folder that can be downloaded via FTP. If needed, there are more details at WordPress backup.
2. Backup the data for easy transfer to the new database
For a fresh start, all the data you imputed into the WordPress site needs to be backed up in a way that it can be imported into the new database (while leaving the corrupted parts of the old database behind). This will include:
- All posts, pages, comments, custom fields, terms and navigation menus: This is done by going to Tools>Export in WordPress admin and downloading the file. This should cover the lion’s share of your work.
- Theme settings: Many themes will have a way to back these settings in an export file. If not, record them somewhere outside the site.
- Plugin and miscellaneous settings: Since plugins will not be backed up, save any needed plugin settings (if there is no backup feature). To ensure nothing important is lost, it is recommended to simply go into each tab in the WordPress dashboard and record all settings.
3. Create a new database
Go into cPanel and create a new database and user. Record the database name, user and password on the wp-config file (after creating a backup of the one on the current site) just as they would be recorded when setting up WordPress.
Go to installing WordPress at the WP site for reference if needed.
4. Upload the wp-config file and reinstall WordPress
Once the wp-config file has been uploaded into public_html, the site will be pointing to the new database. Go to http://example.com/wp-admin/install.php and set up the site with a user and password just as was done in the original install.
After logging in, activate the theme and import the posts, pages, etc. by going to Tools>Import (install recommended importer plugin if needed). Once that is done, restore the theme and plugin settings (plugins will have to be reactivated) as well as any other settings that may have been lost.
None of this will take very long if everything has been backed up properly. Note that the previous wp-config file can be uploaded and the previous site restored if things go wrong. Once you are sure everything is working properly, go back into cPanel and delete the old database.
Option A for fixing database problems: Do a totally new install
To be certain of eliminating the problem, some people will want to delete all files (rather than just uploading the modified wp_config file) and do a totally fresh WordPress install. Once finishing the WordPress setup, import and restore the settings as described above. When using this method on a site with pictures to restore, FTP the “uploads” folder from wp-content>uploads of the old site to the new one (overwriting the new one). The theme and the plugins will need to be reinstalled from scratch, but this should not take long if you know what you had and the settings.
Replacing files while keeping the database
In the less likely event of a problem with the WordPress files but not the database, do the following (after creating a backup):
- Download a new version of WordPress and unzip the folder
- Connect to the site via FTP and delete all folders and files EXCEPT wp-config. .htaacess and wp-content.
- Apart from the above folder and two files, upload the new files from the freshly downloaded WordPress folder.
- Note, any special files not in the normal WordPress installation that you may have uploaded (such as a favicon) that you will continue to use should also be kept on the site or uploaded again from the backup.
None of the above procedures should be difficult or time consuming for anyone familiar with WordPress. Absolute beginners having trouble with their sites who are not comfortable with these steps should consider asking a friend or freelancer to do them. As a general rule, the above is a lot easier than looking at code to find a problem and is a way anyone can fix their own site.