Using the CMP – Coming Soon & Maintenance Plugin by NiteoThemes plugin allows you to put up a message while you are developing a site. On rare occasions you want to be able to launch the site at a specified time. I was able to find a way to set a launch date and then have it check to see if their is a scheduled event set to fire at this specified time. If not then schedule the firing of the deactivate this plugin if it is activated in essence launching the website at a specific date and time.
Add the following code to the child theme's functions.php file for your site
$launch_date = wp_strtotime('June 8, 2022 00:00:00'); if ( !wp_next_scheduled( 'deactivate_plugin_conditional_hook' ) && time() <= $launch_date ) { wp_schedule_single_event( $launch_date, 'deactivate_plugin_conditional_hook' ); } add_action( 'deactivate_plugin_conditional_hook', 'deactivate_cmp_plugin' ); function deactivate_cmp_plugin() { $plugin_path = 'cmp-coming-soon-maintenance/niteo-cmp.php'; if ( is_plugin_active($plugin_path) ) { deactivate_plugins($plugin_path); } } function wp_strtotime($str) { $datetime = new DateTime($str, wp_timezone()); return $datetime->format('U'); }
I have included my wp_strtotime function in the code provided above but you can read up more about this via its own snippet.
This can be used to deactivate any plugin at a specified date and time, not just a coming soon page plugin like this example shows.