Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Last active October 8, 2022 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickposner/26c992719c3efa31fb9359997e18fcf0 to your computer and use it in GitHub Desktop.
Save patrickposner/26c992719c3efa31fb9359997e18fcf0 to your computer and use it in GitHub Desktop.
Simply Static: Run a full static export daily.
<?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