This one is actually surprisingly simple; add this to your wp-config.php file and all automatic updates will be blocked when outside of the specified hours:
// Suspend updates when outside of business hours, 9:00 AM to 5:30 PM
$updates_suspended = (date('Hi') < 0900 || date('Hi') > 1730);
define( 'AUTOMATIC_UPDATER_DISABLED', $updates_suspended );
You can also use these other constants and filters to control which automatic updates are allowed to run if you need to make this more specific.
Make sure you use the server timezone when you set this. The function
date()
might be configured to use a timezone that is different from your local timezone.
Related Posts:
- Uncaught Error: Call to undefined function wp_generate_attachment_metadata() @ wp-cron
- What happens when wp_cron is deactivated in WordPress?
- wp_schedule_single_event function not working
- How ( and mostly at what time ) can i prevent the alternate cron from running?
- Why is wp-cron only executing on page visit?
- Does using WP-cron make the site slower for the user?
- wp_schedule_single_event not working: cron job is triggered but nothing gets executed
- How does task scheduler plugin implements cron that is not dependent on page load request? [closed]
- How to set intervals in cron jobs?
- Switch from wp-cron to a server cron job
- What causes wp_schedule_single_event to fire off?
- WordPress cron job running more than once
- Cron: Update four post at Hour
- Activate Plugin Automatically After Set Time
- WP_CRON issue with UTC and local time
- Better way to run heavy scripts using WordPress database
- WordPress Cron function is not working
- WordPress crob job performance
- Adding custom cron_schedule prior to wp_schedule_event
- Hook automatic_updates_complete to autoupdate plugin
- WordPress “wp cron event run” as Siteground cron job
- CPU Overloading due to some hooks
- Cron Job not working
- What is this async request in wordpress
- Hook into existing tinyMCE button
- Cron Job not working in plugin
- How to get post ID with hooks publish_post, new_to_publish, etc
- Setup wp_schedule_event within a custom plugin
- edit_user_profile and show_user_profile are not firing inside a class
- Template filter for custom taxonomy terms
- I should enable automatic updates?
- Add sub menu page in your plugin
- how to change automatic placing of social plugins below content?
- What exactly happens to function argument availability when using a filter?
- Combining several CSS files into one for optimization
- the_post hook is not firing for me
- Why do plugins often ask to add in to templates?
- Deactivate JS Script in Plugin Shortcode
- Check filter defined or not?
- Create a post builder skin in a plugin
- remove_action not removing add_action from constructor
- Plugin Development – Functions or Hooks?
- How to get menu location in wp_update_nav_menu hook
- How do I add some javascript validation to the admin interface form’s onsubmit?
- Can my hooked uninstall class function access a global var declared in main plugin file?
- Flipping Book PHP Code? Any experience?
- Turning on output buffering in a wordpress plugin
- Hook for page Request?
- Display Plugin Panels Outside of Admin Areas
- Are there action hooks for comments?
- How to remove js ui library added by default by wordpress
- How to use template_include hook with form submission?
- Adding Plugin Assets to Header
- Add item to the woocommerce dashboard menu from a plugin
- How to execute plugin and theme updates from a web hook / endpoint?
- How to use the pre_option filter before a plugin loads?
- What are admin hooks
- How do I add $_SESSION[”] to my wordpress page?
- WordPress Console Application (ability to excecute a custom function via crontab only)
- get_edit_post_link() not working on wp-cron
- get_users(); Is an Undefined Function When Used in Cron Job
- WooCommerce: after install hook
- How to use filter to disable adding a product to wishlist?
- Save user total active time after login in wordpress [closed]
- WordPress: Add custom add_filter for custom functions
- WordPress cronjob get scheduled but function does not run
- How to remove a class function from a plugin by using remove_action()?
- Advanced WordPress plugin activation detection
- Plugin scheduled event not working
- profile_update hook doesn’t works inside a class
- wp_loaded with static Singleton
- wp_trash_post hook – problem with page updating if using wp_die
- How to return the values from a row where a value occurs for the first time among the rows available?
- Function added to hook “new_to_publish” not executing – custom plugin
- is it possible to hook every page style?
- Comment Approve – Add custom function when comment is approved
- How (or where) do I get wordpress plugin update download link?
- Plugin: Hooking up classes that have their own hooks
- Add action to custom Function
- Hook for altering the content of all wp mails
- Hook on creating a menu entry?
- What is the best way to hook a rewrite function for certain php code when plugins are updated?
- What hook can I use to modify custom post data before it is displayed on the page?
- How to hook into action/filter call
- Quick press publish post hook
- Prevent plug-in scripts on a specific template?
- using wp_footer hook in a plugin
- How to deactivate my plugin upon deactivation of NextGen
- How to automatically activate users after registration without activation email?
- Creating a plugin that will display text on every page
- Hooks to run after a core upgrade?
- Determining Whether Automatic Upgrade will Fail?
- I’m looking for a plugin to execute a specific task a certain time
- Plugin Hook When New Author Added
- Adding custom Field To The Posts Listing
- Hook for plugin to insert into entry-meta
- How can i find the cron jobs that run on my site and then move them to the server side?
- Why does “updated_post_meta” did not fire when uploading media other than image?
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Change Dashboard URL from wp-admin to wp-admin/index.php