Created
January 4, 2018 04:57
-
-
Save whyisjake/38404febaeaf2a9e36e74a58904c08c3 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
<?php | |
/** | |
* Test Callback on Publish | |
* | |
* @package News-Nerds | |
*/ | |
add_action( 'publish_post', 'callback_function_to_run_on_publish', 999 ); | |
/** | |
* Callback method to kick of a cron event | |
* | |
* @param int $post_id Post ID. | |
* @return void | |
*/ | |
function callback_function_to_run_on_publish( $post_id ) { | |
if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) { | |
return; | |
} | |
wp_schedule_single_event( time(), 'actual_function_that_i_want_call', array( $post_id ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment