We use automatic updates on our sites due to having many sites and so manual updates not being feasible in the low hosting costs.

But due to Wordpress or mainly plugin updates having the possibility to break your site, and due to not knowing when Wordpress would actually do the updates which could also occur every day, I would like to programatically update Wordpress and plugins in a functions.php or plugin so I can know the exact date and time it will run, and so we know to check for problems afterwards.

For example, I may choose Monday mornings 3am so our first action that morning is check all sites are working well, fix any issues, and then I know the rest of the week will be problem free :)

Does anyone know how to initiate a Wordpress and plugin update in the functions file or a plugin?

My idea is to disable all automatic updates generally, but then at a certain day and time to call the update function which would check if updates exist, and if they do, update them. I will add an email function to inform me what has been updated on what site so I can check that site.

If using automatic updates, this approach is far more controlled than if leaving Wordpress do it as and when it likes however many times every day.


  • You can do a scheduled task everyday and put in the wp update function if the wp version has changed or if it is a new w version. Feb 23, 2019 at 18:41

2 Answers 2


There's a question and an answer regarding WP (auto) updates here, How To/What triggers a Wordpress auto update?

The answer also has a link to a blog post on how to force WordPress auto-update.

Code snippet posted on the referenced blog,

  // request-update.php
  require( dirname(__FILE__) . '/wp-load.php' );


php ./request-update.php

Perhaps you can use this and a real (not WP) cron job to update your site(s) at a certain day and time.


Then there's the do_core_upgrade function.

Edit 2

Oh, and then there's wp_update_plugins and wp_update_themes, too. These are defined in wp-includes/update.php (trac).

Edit 3

Actually, wp_ajax_update_plugin might be better reference point for creating a custom plugin update process. There's also the Plugin_Upgrader class. For themes there's wp_ajax_update_theme for reference and Theme_Upgrader class.

  • So the WP update functions will check if an update exists in WP AND plugins, and only update if it does? So we dont need to worry about checking if updates exist, just run the update at a scheduled time and all is taken care of? Feb 25, 2019 at 10:34
  • It looks like the runmethod from WP_Automatic_Updater which the wp_maybe_auto_update uses does exaclty that. It checks if there are any updates for plugins, themes and core. If there is, it processes them. Feb 25, 2019 at 15:15

wp-disable-plugin-update.php smart updating knowledge growth WordPress code

 * Prevent update notification for plugin
 * http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
 * Place in theme functions.php or at bottom of wp-config.php
function disable_plugin_updates( $value ) {
  if ( isset($value) && is_object($value) ) {
    if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
      unset( $value->response['plugin-folder/plugin.php'] );
  return $value;
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.