Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 4 months ago

#60631 closed defect (bug) (invalid)

block_core_navigation_render_inner_blocks block taxonomy type is 'tag', should be 'post_tag'

Reported by: anaid's profile anaid Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords: dev-feedback close
Focuses: Cc:


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 @swissspidy
5 months ago

  • Component changed from Taxonomy to Editor
  • Focuses multisite removed
  • Keywords dev-feedback close added

From what I can see, the type attribute for the core/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 and build_variation_for_navigation_link then create block variations for every registered post type and taxonomy. There, there is a mapping to post_tag as expected.


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.

#2 @anaid
5 months ago

Edit: build_variation_for_navigation_link returns



[name] => tag
[title] => Tag Link
[description] => A link to a tag.
[attributes] => Array


[type] => tag
[kind] => taxonomy




Seems like it doesn't actually return post_tag, just uses it internally.

Last edited 5 months ago by anaid (previous) (diff)

#3 @anaid
5 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Ah, never mind, I get it. I'll build a reverse lookup myself using the methods you supplied.

Thank you

#4 @swissspidy
4 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.