#60631 closed defect (bug) (invalid)
block_core_navigation_render_inner_blocks block taxonomy type is 'tag', should be 'post_tag'
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | dev-feedback close |
Focuses: | Cc: |
Description
In the block_core_navigation_render_inner_blocks
filter, when iterating over the menu items, the type
attribute for a Post Tag has value 'tag'
. However, to retrieve information about this taxonomy, the get_taxonomy
method requires value 'post_tag'
. Seems like a rename was performed somewhere while implementing the block editor.
function block_core_navigation_render_inner_blocks($items) { foreach ($items as $key => $item) { $type = $item["attr"]["type"]; $taxonomy = get_taxonomy($type === "tag" ? "post_tag" : $type); // Required workaround because of discrepancy // <snip> } return $items; }
Change History (4)
#1
@
12 months ago
- Component changed from Taxonomy to Editor
- Focuses multisite removed
- Keywords dev-feedback close added
#2
@
12 months ago
Thanks for your message.
The use case is for taxonomies only. How to I get the corresponding taxonomy for a navigation-link block?
The functions you mention map from post_tag
to tag
but I need the reverse..
Version 0, edited 12 months ago
by
(next)
Note: See
TracTickets for help on using
tickets.
From what I can see, the
type
attribute for thecore/navigation-link
block does not map 1:1 to a taxonomy type. Type refers to the type of link. It could be "page", "post", "category", "tag", or something custom.In this regard the code you shared is flawed as
$item["attr"]["type"]
does not actually mean it's about a taxonomy.block_core_navigation_link_build_variations
andbuild_variation_for_navigation_link
then create block variations for every registered post type and taxonomy. There, there is a mapping topost_tag
as expected.See https://github.com/WordPress/gutenberg/blob/705d77cd19b36ec36a04b7918aeab7282747d4a7/packages/block-library/src/navigation-link/index.php#L269-L326
So from what I can see it works as expected.
Please note that tickets related to the Gutenberg Editor should be filed on the Gutenberg GitHub Repository in general. So if you still think there is something that needs to be changed, please open an issue there for discussion.