Force WordPress To Check For Plugin Updates
A good feature of WordPress is the ability to automatically update plugins and themes with just a click of a button. On other CMS's when a new version of a plugin or theme is made available you have to download the plugin and FTP this up to the server to update the plugin. Obviously this isn't ideal if your client isn't very comfortable with making changing to the files on FTP, this leads to plugins and themes not being updated for years.
But in WordPress you are alerted to any plugins that have an update available and there will constantly be an alert on the menu of the admin area.
When you go to the plugin screen you will see what plugins need to be updated and are presented with a link so that you can update the plugin automatically.
This update service will check every 12 hours to the HTTP API to see if there is a new version available. If there is a new version available then WordPress will display the above notification to the user. The checks for the new plugins are stored in a site transient called update_plugins, this is where you will see when they were last checked so WordPress will know when it should be checked again.
Changing Plugin Check Times
If you want to change the time it takes WordPress to check if plugins need to be updated then you can change the transient expiry time by changing the $timeout variable within /wp-includes/update.php in the wp_update_plugins function. While development is happening you can change this to 5 minutes for WordPress to do check for updates every 5 minutes.
Force WordPress To Check For Updates
If you want WordPress to check for updates straight away then all you have to do is delete the transient value for the update_plugins. The easiest way of doing this is at a database level, all you have to do is open your database and run the query to remove the value for the _site_transient_update_plugins option.
update wp_options set option_value='' where option_name='_site_transient_update_plugins';
Learn how to code with Treehouse
- Learn projects with access to 1000+ videos
- Practice live with our Code Challenge Engine
- Get help in our members-only forums
Join the weekly newsletter
Sign up for our newsletter. You'll be updated on new tutorials as they come available.
Subscribe today and get a 50% discount code to Paulund