Last active
December 14, 2019 10:04
-
-
Save danielstrelec/814cbf25692fe6179430d8d0fa8064f7 to your computer and use it in GitHub Desktop.
This file contains 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
// delete specific post(s) | |
function wt_cron_delete_posts() { | |
// wp_delete_post( int $postid, bool $force_delete = false ) | |
wp_delete_post(1); | |
} | |
add_action( 'wt_delete_old_posts','wt_cron_delete_posts' ); | |
$args = array( false ); | |
if ( !wp_next_scheduled( 'wt_delete_old_posts', $args ) ) { | |
// time() + 3600 = one hour from now | |
wp_schedule_single_event( time() + 3600, 'wt_delete_old_posts' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment