Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a filter to prevent async post status event from being scheduled #964

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions async-publish-actions.php
Expand Up @@ -122,6 +122,16 @@ function _queue_async_hooks( $new_status, $old_status, $post ) {
'old_status' => $old_status,
];

/**
* Filter whether or not a cron event should be scheduled when the post transitions status.
*
* @param bool $true Whether or not to schedule the cron event.
* @param array $args Array of arguments containing the post_id, new_status, and old_status.
*/
if ( false === apply_filters( 'wpcom_async_transition_post_status_schedule_async', true, $args ) ) {
return;
}

if ( false !== wp_next_scheduled( ASYNC_TRANSITION_EVENT, $args ) ) {
return;
}
Expand Down