diff --git a/includes/Admin/Post_Type_Form_Page.php b/includes/Admin/Post_Type_Form_Page.php index 643389e..2556ed9 100644 --- a/includes/Admin/Post_Type_Form_Page.php +++ b/includes/Admin/Post_Type_Form_Page.php @@ -85,7 +85,7 @@ public function render_form(): void { $post_type_data = null; $post_type = get_post_type_object( $post_type_name ); - $taxonomies = get_taxonomies( array( '_builtin' => false ) ); + $taxonomies = $this->get_taxonomies_filtered(); if ( $post_type instanceof WP_Post_Type ) { $post_types = get_option( CUSTOM_PTT_POST_TYPE_OPTION_NAME, array() ); @@ -94,4 +94,27 @@ public function render_form(): void { require __DIR__ . '/templates/custom-ptt-post-types-form.php'; } + + /** + * Filter taxonomies to show built-in public ones as well as custom ones. + * + * @return array + * + * @since 0.2.1 + */ + private function get_taxonomies_filtered(): array { + $taxonomies = get_taxonomies( array(), 'objects' ); + $filtered_taxonomies = array(); + + foreach ( $taxonomies as $key => $taxonomy ) { + + if ( $taxonomy->_builtin && ! $taxonomy->public ) { + continue; + } + + $filtered_taxonomies[ $key ] = $taxonomy; + } + + return $filtered_taxonomies; + } } diff --git a/includes/Admin/templates/custom-ptt-post-types-form.php b/includes/Admin/templates/custom-ptt-post-types-form.php index 5ba3682..228a7fd 100644 --- a/includes/Admin/templates/custom-ptt-post-types-form.php +++ b/includes/Admin/templates/custom-ptt-post-types-form.php @@ -72,10 +72,16 @@