diff --git a/includes/Classifai/Admin/Settings.php b/includes/Classifai/Admin/Settings.php index 2a98b353d..c47945e6e 100644 --- a/includes/Classifai/Admin/Settings.php +++ b/includes/Classifai/Admin/Settings.php @@ -8,6 +8,7 @@ use function Classifai\get_plugin; use function Classifai\get_services_menu; use function Classifai\get_post_statuses_for_language_settings; +use function Classifai\is_elasticpress_installed; class Settings { @@ -83,12 +84,13 @@ public function admin_enqueue_scripts( $hook_suffix ) { wp_set_script_translations( 'classifai-settings', 'classifai' ); $data = array( - 'features' => $this->get_features(), - 'services' => get_services_menu(), - 'settings' => $this->get_settings(), - 'dashboardUrl' => admin_url( '/' ), - 'nonce' => wp_create_nonce( 'classifai-previewer-action' ), - 'postStatuses' => get_post_statuses_for_language_settings(), + 'features' => $this->get_features(), + 'services' => get_services_menu(), + 'settings' => $this->get_settings(), + 'dashboardUrl' => admin_url( '/' ), + 'nonce' => wp_create_nonce( 'classifai-previewer-action' ), + 'postStatuses' => get_post_statuses_for_language_settings(), + 'isEPinstalled' => is_elasticpress_installed(), ); wp_add_inline_script( diff --git a/src/js/settings/components/feature-settings/index.js b/src/js/settings/components/feature-settings/index.js index 344757e5d..0e53f76f6 100644 --- a/src/js/settings/components/feature-settings/index.js +++ b/src/js/settings/components/feature-settings/index.js @@ -51,6 +51,21 @@ const PersonalizerDeprecationNotice = () => ( ); +const ElasticPressRequiredNotice = () => ( + +

+ { __( + 'The Smart 404 Feature requires the ElasticPress plugin to be installed and active prior to use.', + 'classifai' + ) } +

+
+); + /** * Feature Settings component. * @@ -83,6 +98,14 @@ export const FeatureSettings = ( { onSaveSuccess = () => {} } ) => { ); } + // Show ElasticPress required notice if the feature is Smart 404 and ElasticPress is not active. + if ( + 'feature_smart_404' === featureName && + ! window.classifAISettings?.isEPinstalled + ) { + return ; + } + return ( <> { 'feature_recommended_content' === featureName && (