diff --git a/includes/Classifai/Providers/Azure/TextToSpeech.php b/includes/Classifai/Providers/Azure/TextToSpeech.php index bd612f81f..b426dfafc 100644 --- a/includes/Classifai/Providers/Azure/TextToSpeech.php +++ b/includes/Classifai/Providers/Azure/TextToSpeech.php @@ -188,7 +188,7 @@ public function setup_fields_sections() { 'label_for' => 'post_types', 'option_index' => 'post_types', 'options' => $this->get_post_types_select_options(), - 'default_values' => $default_settings['post-types'], + 'default_values' => $default_settings['post_types'], ] ); @@ -238,6 +238,9 @@ public function sanitize_settings( $settings ) { if ( ! empty( $current_settings['voices'] ) ) { $current_settings['authenticated'] = true; + } else { + $current_settings['voices'] = []; + $current_settings['authenticated'] = false; } } } else { @@ -434,7 +437,7 @@ public function get_default_settings() { 'voices' => array(), 'voice' => '', 'authenticated' => false, - 'post-types' => array(), + 'post_types' => array(), ]; } diff --git a/src/js/gutenberg-plugin.js b/src/js/gutenberg-plugin.js index be2eb044c..698457181 100644 --- a/src/js/gutenberg-plugin.js +++ b/src/js/gutenberg-plugin.js @@ -217,7 +217,8 @@ const ClassifAITTS = () => { // Post type label. const postTypeLabel = useSelect( ( select ) => - select( 'core/editor' ).getPostTypeLabel() || + ( typeof select( 'core/editor' ).getPostTypeLabel !== 'undefined' && + select( 'core/editor' ).getPostTypeLabel() ) || __( 'Post', 'classifai' ) );