Last active
October 8, 2022 09:31
-
-
Save patrickposner/26c992719c3efa31fb9359997e18fcf0 to your computer and use it in GitHub Desktop.
Simply Static: Run a full static export daily.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_activation_hook( __FILE__, 'ss_setup_static_daily_export_cron' ); | |
/** | |
* Setup a cron job to run daily. | |
* | |
* @return void | |
*/ | |
function ss_setup_static_daily_export_cron() { | |
if ( ! wp_next_scheduled( 'ss_static_export_daily_cron' ) ) { | |
wp_schedule_event( time(), 'daily', 'ss_static_export_daily_cron' ); | |
} | |
} | |
add_action( 'ss_static_export_daily_cron', 'ss_run_static_export_cron_daily' ); | |
/** | |
* Run a full static export daily. | |
* | |
* @return void | |
*/ | |
function ss_run_static_export_cron_daily() { | |
// Full static export | |
$simply_static = Simply_Static\Plugin::instance(); | |
$simply_static->run_static_export(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment