diff --git a/includes/Classifai/Helpers.php b/includes/Classifai/Helpers.php index 3b582c1c2..0fd37c26d 100644 --- a/includes/Classifai/Helpers.php +++ b/includes/Classifai/Helpers.php @@ -171,6 +171,32 @@ function get_watson_password() { } } +/** + * Get post types we want to show in the language processing settings + * + * @since 1.6.0 + * + * @return array + */ +function get_post_types_for_language_settings() { + $post_types = get_post_types( [ 'public' => true ], 'objects' ); + + // Remove the attachment post type + unset( $post_types['attachment'] ); + + /** + * Filter post types shown in language processing settings. + * + * @since 1.6.0 + * @hook classifai_language_settings_post_types + * + * @param {array} $post_types Array of post types to show in language processing settings. + * + * @return {array} Array of post types. + */ + return apply_filters( 'classifai_language_settings_post_types', $post_types ); +} + /** * The list of post types that get the ClassifAI taxonomies. Defaults * to 'post'. diff --git a/includes/Classifai/Providers/Watson/NLU.php b/includes/Classifai/Providers/Watson/NLU.php index ef789ba47..2e39ca04c 100644 --- a/includes/Classifai/Providers/Watson/NLU.php +++ b/includes/Classifai/Providers/Watson/NLU.php @@ -8,6 +8,7 @@ use Classifai\Admin\SavePostHandler; use Classifai\Providers\Provider; use Classifai\Taxonomy\TaxonomyFactory; +use function Classifai\get_post_types_for_language_settings; class NLU extends Provider { @@ -390,7 +391,7 @@ class="" */ public function render_post_types_checkboxes( $args ) { echo '