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:
- Which approach for managing automatic updates would be more robust?
- 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
- Cron Job not working
- How can I see all the actions attached to an “add_action” hook?
- How to include code only on specific pages?
- Changing the “Plugin Activated” Message Default
- How to disable core and plugin updates
- Better to fire specific hooks or generic hooks with parameters?
- How to only hook on Single.php after content?
- How to save the values of checkbox to the register setting?
- Can we hook a static method of a class to add_action inside that class?
- What is the ‘admin_action_’ . $_REQUEST[‘action’] hook used for?
- Filter out results from REST API
- How can I remove a hooked action created by a plugin?
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- Posts wont expire
- disable active plugins for specific theme
- Twillio How To Send SMS for Custom Post Type
- Hide WordPress Plugin Deactivation Links
- Find out if request is for custom post type archive before query runs
- Does the ‘nav_menu_css_class’ filter accept 2 or 3 arguments?
- do_action and hook methods
- the_posts hook, which set of posts?
- Is it possible to add an action to the currently running action?
- OOP: Display warning and deactivate the plugin if PHP version is less than 5.4
- Over write plugin templates
- Determine plugin name from within plugin_action_links filter
- How to prevent action in ajax request, when in admin side?
- action-scheduler vs wp-background-processing
- Easy Digital Downloads (EDD) – Purchase Receipt emails couldn’t be logged
- Remove obsolete plugins artifacts from database tables
- Placement of Code in Plugin for hooking `save_post`
- Can I use a method from an existing plugin as an action hook?
- Reposition Woocommerce Message
- How to initialize something in unit test before the init hook being called?
- Restored WordPress on new Server – Can’t auto-update plugins
- Prevent a plugin from being automatically activated
- How get a value from a plugin into another plugin through action/filter
- Can’t update/install plugins or WordPress
- Private Plugin Updates – Localhost
- Any hook for pre-plugin-update -either bulk or single plugin update
- Cron job not firing
- How do I display only the latest post on my home page, while maintaining proper plugin hooks?
- Modifying the comments section through a plugin regardless of theme
- wp_get_post_terms is difference obj model than the one in rest api response
- Get Time Taken By Each Action Hook in WordPress
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- How to make a implement queue for scheduling tasks in WordPress?
- Best place for short bio,image and button [closed]
- wp cron job fires at every second or so, if callback is wrapped with DOING_CRON check it never fires at all
- password_reset hook is not working
- The Hook registration_errors was not called
- Why do plugins often ask to add in to templates?
- How to get menu location in wp_update_nav_menu hook
- How to execute plugin and theme updates from a web hook / endpoint?
- WordPress Console Application (ability to excecute a custom function via crontab only)
- Save user total active time after login in wordpress [closed]
- Advanced WordPress plugin activation detection
- wp_loaded with static Singleton
- How to return the values from a row where a value occurs for the first time among the rows available?
- How to hook into action/filter call
- How to automatically activate users after registration without activation email?
- Adding custom Field To The Posts Listing
- Add hook after content without formatting
- Using Remove Action Hook in Plugin
- admin_post hook not firing function inside class
- Display Woocommerce attribute name above product title
- Update (a function) post’s featured image as soon as $image_url changes
- Add a filter to a method in the parent theme
- Run only on plug-in activation instead of wp_head
- error_log() not working in add_filter auto update callback
- Transition Post status not working
- Plugin Hooks Not Shown in WP Cron Jobs
- add query string to all pages after user logged in
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- Neither update_option nor delete_option fires in deactivation hook
- Plugin_Upgrader not working if function is called from remote server
- WordPress : how to create onglet and remove it when only one
- View Version Details” on Plugin update shows “Plugin not found