You have two tasks to solve here: 1. Resolve the time-out problem. 2. Update WordPress.
Resolve the time-out problem
These things don't just happen because your WP is old. There must be a concrete reason.
The three most common reasons are:
Not enough memory. Maybe your hosting provider has limited the memory?
Try adding the following line in your wp-config.php
above the "Happy blogging" line:
define('WP_MEMORY_LIMIT', '256M');
If that doesn't help, ask your provider.
A very large option is stored in your database and fetched on every request. Go to your database management tool, like phpMyAdmin, and sort the wp_options
table (assuming your table prefix is wp_
by the size of the value
column. If there is any very large option, consider deleting it. But make a database backup first!
Some plugin is making a request to an external source, overriding WordPress’ pre-set time-out, and the remote site doesn't respond in time. Disable all plugins, and see if that helps. Then re-enable them one after another, until the issue reappears. Deactivate that plugin, and try to find an alternative.
Update WordPress
- Make a backup of your database.
- Make a backup of your uploads. They shouldn't be affected by the update, but it's always nice to have that backup.
- If you are using a default theme (named Twenty-X) and made changes to it — which you absolutely shouldn't — back up that theme too.
- Disable all plugins, and switch to a default theme.
- Update WordPress.
- Re-enable the theme and the plugins, again one by one, check that everything is working as expected. If it doesn't, you might need your backups to roll everything back, but that's not very likely.
- Update your plugins.
That's it.
There are tools like Deployer that can help automate this process, and they make it easy to roll back a broken update within seconds to the last working state. You might want to learn using such a tool.