New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Taxonomies Don't Show in the sidebar #3369

Closed
tomjn opened this Issue Nov 7, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@tomjn
Copy link
Contributor

tomjn commented Nov 7, 2017

Issue Overview

When viewing the Gutenberg editor, categories and tags appear in the sidebar, however, custom taxonomies do not

Steps to Reproduce (for bugs)

  1. Add a custom taxonomy to posts or a custom post type
    2.Open the Gutenberg editor
    3.The new taxonomies do not have a UI, and if only CT's are present, the categories and tags drawer shows nothing when expanded

Expected Behavior

I expected to see the Custom taxonomies shown the same was categories and tags are shown

Current Behavior

No custom taxonomy UI is available

Possible Solution

Show the custom taxonomies as categories and tags are shown, respecting the visibility and hierarchy attributes set on registration

@aduth

This comment has been minimized.

Copy link
Member

aduth commented Nov 7, 2017

Can you confirm whether the taxonomy has the show_in_rest property assigned as true? Since the editor operates using the REST API, taxonomies and post types must be whitelisted to be accessible within the editor. This is a restriction of the API itself, and one which has caused some trouble in the past.

Related: #2340, #3066

@lukecav

This comment has been minimized.

Copy link

lukecav commented Nov 7, 2017

You can replicate by trying WooCommerce with Gutenberg, none of the product categories using product_cat will display in Gutenberg, when say editing or creating a new product.

@lukecav

This comment has been minimized.

Copy link

lukecav commented Nov 7, 2017

function wc_product_category_add_tax_to_api() { $mytax = get_taxonomy( 'product_cat' ); $mytax->show_in_rest = true; } add_action( 'init', 'wc_product_category_add_tax_to_api', 30 );

Then the product categories would show.

gutenberg product categories

@tomjn

This comment has been minimized.

Copy link
Contributor Author

tomjn commented Nov 7, 2017

hmmm yes adding show_in_rest to my registration fixed the issue, though it's still a regression

I would expect that since anybody with editor access will have Gutenberg access then would it make sense to make it so that show_in_rest was true by default is current_user_can indicate the logged in user can modify that taxonomy? This would fix the issue without revealing terms to the public or subscribers that could cause issues

@aduth

This comment has been minimized.

Copy link
Member

aduth commented Nov 7, 2017

I would expect that since anybody with editor access will have Gutenberg access then would it make sense to make it so that show_in_rest was true by default is current_user_can indicate the logged in user can modify that taxonomy? This would fix the issue without revealing terms to the public or subscribers that could cause issues

This may work, and is a question more of general REST API authorization behavior than it is specific to Gutenberg. It does impact the editing experience of course, and ought to be raised for consideration. Also relevant to #3066 and previously discussed at #1342 (comment).

@mtias

This comment has been minimized.

Copy link
Contributor

mtias commented Nov 20, 2017

Closing as duplicate of #3066 so we can keep the conversation in a single place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment