From b3f24fc4ca3dae12f114ce02a39b888882cd773d Mon Sep 17 00:00:00 2001 From: Leo Germani Date: Fri, 25 Jan 2019 15:09:51 -0200 Subject: [PATCH] fix - show_in_rest attr to taxonomies used by post types --- src/classes/entities/class-tainacan-taxonomy.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/classes/entities/class-tainacan-taxonomy.php b/src/classes/entities/class-tainacan-taxonomy.php index 06bb3750b..af5c94265 100644 --- a/src/classes/entities/class-tainacan-taxonomy.php +++ b/src/classes/entities/class-tainacan-taxonomy.php @@ -67,11 +67,16 @@ class Taxonomy extends Entity { 'new_item_name' => __( 'New Genre term', 'tainacan' ), 'menu_name' => $this->get_name(), ); + + $enabled_post_types = $this->get_enabled_post_types(); + $enabled_post_types = sizeof($enabled_post_types) ? $enabled_post_types : null; + $show_ui = is_array($enabled_post_types) ? true : false; $args = array( 'hierarchical' => true, 'labels' => $labels, - 'show_ui' => true, + 'show_ui' => $show_ui, + 'show_in_rest' => $show_ui, 'show_admin_column' => false, 'rewrite' => [ 'slug' => $this->get_slug() @@ -82,8 +87,7 @@ class Taxonomy extends Entity { unregister_taxonomy($this->get_db_identifier()); } - $enabled_post_types = $this->get_enabled_post_types(); - $enabled_post_types = sizeof($enabled_post_types) ? $enabled_post_types : null; + register_taxonomy( $this->get_db_identifier(),