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 '
';
- $post_types = get_post_types( [ 'public' => true ], 'objects' );
+ $post_types = get_post_types_for_language_settings();
foreach ( $post_types as $post_type ) {
$args = [
'label_for' => $post_type->name,
diff --git a/tests/e2e/wpacceptance/NaturalLanguageProcessing.php b/tests/e2e/wpacceptance/NaturalLanguageProcessing.php
index 77d529cbb..ca5484d76 100644
--- a/tests/e2e/wpacceptance/NaturalLanguageProcessing.php
+++ b/tests/e2e/wpacceptance/NaturalLanguageProcessing.php
@@ -187,44 +187,6 @@ public function testTogglePage() {
}
- /**
- * @testdox When the user enables/disables Media under Post Types to Classify, it shows/hides Watson Keywords and other submenus under Media menu.
- */
- public function testToggleMedia() {
-
- $I = $this->openBrowserPage();
-
- $I->login();
-
- $I->moveTo( 'wp-admin/upload.php' );
-
- $I->dontSeeLink( 'Watson Categories', 'edit-tags.php?taxonomy=watson-category&post_type=attachment' );
-
- $I->dontSeeLink( 'Watson Keywords', 'edit-tags.php?taxonomy=watson-keyword&post_type=attachment' );
-
- $I->dontSeeLink( 'Watson Concepts', 'edit-tags.php?taxonomy=watson-concept&post_type=attachment' );
-
- $I->dontSeeLink( 'Watson Entities', 'edit-tags.php?taxonomy=watson-entity&post_type=attachment' );
-
- $I->moveTo( 'wp-admin/admin.php?page=language_processing' );
-
- $I->checkOptions( '#classifai-settings-attachment' );
-
- $I->click( '#submit' );
-
- $I->waitUntilNavigation();
-
- $I->moveTo( 'wp-admin/upload.php' );
-
- $I->seeLink( 'Watson Categories', 'edit-tags.php?taxonomy=watson-category&post_type=attachment' );
-
- $I->seeLink( 'Watson Keywords', 'edit-tags.php?taxonomy=watson-keyword&post_type=attachment' );
-
- $I->seeLink( 'Watson Concepts', 'edit-tags.php?taxonomy=watson-concept&post_type=attachment' );
-
- $I->seeLink( 'Watson Entities', 'edit-tags.php?taxonomy=watson-entity&post_type=attachment' );
- }
-
public function testWatsonWorks() {
$I = $this->openBrowserPage();