fix - show_in_rest attr to taxonomies used by post types

This commit is contained in:
Leo Germani 2019-01-25 15:09:51 -02:00
parent 423195debf
commit b3f24fc4ca
1 changed files with 7 additions and 3 deletions

View File

@ -68,10 +68,15 @@ class Taxonomy extends Entity {
'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(),