-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Support for custom taxonomies #1342
Comments
The wording of this issue gives me the impression that Gutenberg will only support custom taxonomies for custom post types – not for regular posts. |
@sbangnielsen Custom taxonomies should also be recognized for builtin post types. I don't think @afercia intended to exclude them in his writeup. |
API issue here. We need to access the custom taxonomies using the REST API even if they don't have the |
@youknowriad This is an interesting conundrum. Can you clarify your assumptions in greater detail? Presumably, this applies to custom post types as well. |
If we want to retrieve the custom taxonomies and the custom post types to display a UI/manage them in WP-Admin, we'd have to retrieve all the entries even the ones that have "show_in_rest" to false. How can we use Gutenberg for a CPT with "show_in_rest=false" right now? It can't work unless we remove this restriction. The more we move things to client-side, the more we'd face this issue. |
I understand your perspective, certainly. I think you've stumbled upon a significant conceptual issue worth significant discussion, not a mere technical implementation issue. I don't have any suggestions for resolution at this point, need to give the issue some thought. cc @rmccue @rachelbaker @joehoyle for visibility |
I think this is a good case for defaulting |
I don't think this is a special case for Gutenberg but I don't think this should be a choice (or maybe it should be always the same as |
Can we get some examples of common taxonomies or post types that have Do these common post types and taxonomies have Does exposing them via the REST API expose information that site owners wouldn't expect? If so, then this probably needs to be handled within the plugins that create the post types and taxonomies in question (this was the plan behind the current implementation of these API flags). |
Yes, we'd need some new permissions model for the REST API where custom post types and taxonomies (or endpoints generically) can define an authorization callback for their existence to be exposed. This way, we could respect the existing behavior in the admin where a custom taxonomy is only displayed upon an authorized request (e.g. editing a post) and not publicly accessible. Put another way, to display a custom taxonomy if |
I'm not sure I agree with this. I do think that the whole concept of I'd see this as a chance to open up more data to the rest api, by changing the defaults, we can still do "public" and "private" content via the normal WP permissions model. |
We need to see specific, commonly-used examples to inform any kind of decision here. |
Props @danielbachhuber for this proposed solution, I think it's a good one: Allow management of post types and taxonomies with This will be the first time that the response structure of the API differs based on the user's authentication level - entirely new endpoints and links will appear. We'll want to take some care that things remain reasonably consistent. Note the correct flag is (counterintuitively) called
This should work from a technical perspective. However I want to emphasize again the value of looking at some examples from WooCommerce or another popular plugin, without seeing what people are actually using this for it's a bit hard to envision how it should behave. |
I created https://core.trac.wordpress.org/ticket/42785 to get some progress on better defaults for content included in the REST API. This doesn't quite address all the cases here such as "private" post types, which I think we can also push ahead. |
#1276 is going to add support for pages and custom post types.
Custom post types can use custom taxonomies (custom "categories" and "tags") and Gutenberg is already providing a UI to add hierarchical and non-hierarchical taxonomies.
In the case of custom post types, the UI should fetch, display, and allow to set the custom taxonomies.
For example, in the current WordPress implementation the tags suggestions correctly fetches custom post type non-hierarchical taxonomy. To see an example of how this works:
The text was updated successfully, but these errors were encountered: