Skip to content

Commit 02c60a3

Browse files
authored
Merge pull request #762 from 10up/fix/allow-new-classification-providers
Ensure custom Classification Providers can fully work
2 parents c9ee0f9 + f96a83e commit 02c60a3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

includes/Classifai/Features/Classification.php

+15
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,21 @@ public function rest_endpoint_callback( WP_REST_Request $request ) {
227227
public function save( int $post_id, array $results, bool $link = true ) {
228228
$provider_instance = $this->get_feature_provider_instance();
229229

230+
/**
231+
* Filter results to be saved.
232+
*
233+
* @since 3.1.0
234+
* @hook classifai_feature_classification_pre_save_results
235+
*
236+
* @param {array} $supported Term results.
237+
* @param {int} $post_id Post ID.
238+
* @param {bool} $link Whether to link the terms or not.
239+
* @param {object} $this Current instance of the class.
240+
*
241+
* @return {array} Term results.
242+
*/
243+
$results = apply_filters( 'classifai_' . static::ID . '_pre_save_results', $results, $post_id, $link, $this );
244+
230245
switch ( $provider_instance::ID ) {
231246
case NLU::ID:
232247
$results = $provider_instance->link( $post_id, $results, $link );

src/js/language-processing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ import '../scss/language-processing.scss';
202202
previewWatson();
203203

204204
const previewEmbeddings = () => {
205-
if ( 'openai_embeddings' !== provider ) {
205+
if ( 'ibm_watson_nlu' === provider ) {
206206
return;
207207
}
208208

0 commit comments

Comments
 (0)