diff --git a/admin/AmazonAI-PollyService.php b/admin/AmazonAI-PollyService.php index 3264a2a6..08498699 100644 --- a/admin/AmazonAI-PollyService.php +++ b/admin/AmazonAI-PollyService.php @@ -72,10 +72,10 @@ public function save_post( $post_id, $post, $updated ) { } } - if( ! ( wp_is_post_revision( $post_id) || wp_is_post_autosave( $post_id ) ) ) { + if( ! ( wp_is_post_revision( $post_id) || wp_is_post_autosave( $post_id ) ) && apply_filters( 'amazon_polly_trigger_post_audio_task', true, $post_id ) ) { $logger->log(sprintf('%s Starting background task process ( id=%s )', __METHOD__, $post_id)); - $background_task = new AmazonAI_BackgroundTask(); - $background_task->trigger(self::GENERATE_POST_AUDIO_TASK, [ $post_id ]); + $background_task = new AmazonAI_BackgroundTask(); + $background_task->trigger(self::GENERATE_POST_AUDIO_TASK, [ $post_id ]); } }