diff --git a/projects/plugins/jetpack/_inc/blogging-prompts.php b/projects/plugins/jetpack/_inc/blogging-prompts.php index c49a5bd3bced1..588b99c19c11e 100644 --- a/projects/plugins/jetpack/_inc/blogging-prompts.php +++ b/projects/plugins/jetpack/_inc/blogging-prompts.php @@ -57,7 +57,16 @@ function jetpack_setup_blogging_prompt_response( $post_id ) { * @return boolean */ function jetpack_are_blogging_prompts_enabled() { - return (bool) get_option( 'jetpack_blogging_prompts_enabled', jetpack_has_write_intent() || jetpack_has_posts_page() ); + $prompts_enabled = (bool) get_option( 'jetpack_blogging_prompts_enabled', jetpack_has_write_intent() || jetpack_has_posts_page() ); + + /** + * Filters whether blogging prompts are enabled. + * + * @since $$next-version$$ + * + * @param bool $prompts_enabled Whether blogging prompts are enabled. + */ + return apply_filters( 'jetpack_are_blogging_prompts_enabled', $prompts_enabled ); } /** diff --git a/projects/plugins/jetpack/changelog/add-blogging-prompts-enabled-filter b/projects/plugins/jetpack/changelog/add-blogging-prompts-enabled-filter new file mode 100644 index 0000000000000..2c5b1772ac43f --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-blogging-prompts-enabled-filter @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Writing prompts: add filter for whether prompts are enabled or not diff --git a/projects/plugins/jetpack/extensions/blocks/blogging-prompts/settings.php b/projects/plugins/jetpack/extensions/blocks/blogging-prompts/settings.php index e263680e0f392..103b7c0b1d313 100644 --- a/projects/plugins/jetpack/extensions/blocks/blogging-prompts/settings.php +++ b/projects/plugins/jetpack/extensions/blocks/blogging-prompts/settings.php @@ -29,6 +29,12 @@ function enabled_field_callback() { * @return void */ function init() { + // If editor extensions are not loaded, don't show the settings. + if ( ! \Jetpack_Gutenberg::should_load() ) { + return; + } + + // Blogging prompts is an expermental extension: if expermental blocks are not enabled, don't show the settings. if ( ! Constants::is_true( 'JETPACK_EXPERIMENTAL_BLOCKS' ) && ! Constants::is_true( 'JETPACK_BETA_BLOCKS' ) ) { return; }