From db76577247d1fb2eabefc9d350f03a5d71922402 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Thu, 22 Oct 2020 15:21:05 -0600 Subject: [PATCH 1/3] Don't default to the post post type if no other types are selected. Just return an empty array --- includes/Classifai/Helpers.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/includes/Classifai/Helpers.php b/includes/Classifai/Helpers.php index efc292355..de5fa66b7 100644 --- a/includes/Classifai/Helpers.php +++ b/includes/Classifai/Helpers.php @@ -191,10 +191,6 @@ function get_supported_post_types() { } } - if ( empty( $post_types ) ) { - $post_types = [ 'post' ]; - } - /** * Filter post types supported for language processing. * From 24f7873b676794be7ce3136f7509c8b2ec47d000 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 23 Oct 2020 08:51:13 -0600 Subject: [PATCH 2/3] Fix test --- tests/Classifai/HelpersTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Classifai/HelpersTest.php b/tests/Classifai/HelpersTest.php index 096c30d04..318e0fa10 100644 --- a/tests/Classifai/HelpersTest.php +++ b/tests/Classifai/HelpersTest.php @@ -29,7 +29,7 @@ function test_it_has_plugin_settings() { function test_it_has_default_supported_post_types() { $actual = get_supported_post_types(); - $this->assertEquals( [ 'post' ], $actual ); + $this->assertEquals( [], $actual ); } function test_it_can_lookup_supported_post_types_from_option() { From f2603fa187928c26ef4c80bc0c8d0e3e1ba99f00 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 23 Oct 2020 09:01:26 -0600 Subject: [PATCH 3/3] Fix another test --- tests/Classifai/Taxonomy/TaxonomyFactoryTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Classifai/Taxonomy/TaxonomyFactoryTest.php b/tests/Classifai/Taxonomy/TaxonomyFactoryTest.php index 44e8c84e2..7ba26d06d 100644 --- a/tests/Classifai/Taxonomy/TaxonomyFactoryTest.php +++ b/tests/Classifai/Taxonomy/TaxonomyFactoryTest.php @@ -52,6 +52,10 @@ function test_it_can_build_all_supported_taxonomies() { } function test_it_connects_watson_taxonomies_to_post_type() { + add_filter( 'classifai_post_types', function() { + return [ 'post' ]; + } ); + $this->factory->build_all(); $actual = get_object_taxonomies( 'post' );