Skip to content

Adding Category Links to a Nav Menu: Rename Custom Category Link #69749

Closed as not planned

Description

@askdesign

What problem does this address?

While writing a tutorial about adding categories to Block Theme menus, I came across 2 kinds of Category Links, one of which had me confused. I've attached a screengrab to help describe what I'm talking about.

  • The Category Link with a square shape comprised of 4 dots is the one that will work as expected. Using that, an existing category can be added to the menu.
  • The Category Link with the asterisk above 2 lines doesn't work as expected. This link is for a custom taxonomy, but I didn't know that until I posted the question in Slack. After a brief discussion, @pbiron came up with an answer in this thread:
    https://app.slack.com/client/T024MFP4J

What is your proposed solution?

I think the labels should be different. Maybe something like "Custom Category Link", to help the average user realize what it is.

Image

Activity

  1. added
    [Type] Enhancement
    on Mar 28, 2025
  2. pbiron commented on Mar 29, 2025

    @pbiron

    @Rishit30G Are there any custom taxonomies registered (e.g. in a plugin) on the site you're testing with? If not, then you won't see the other "variation" of the Category Link block.

  3. askdesign commented on Mar 29, 2025

    @askdesign
    MemberAuthor

    @pbiron I thought you saw it on a vanilla site?
    I am not aware of any custom taxonomies on my site.

    My configuration = child theme of 2024 theme. I disabled several plugins and could still see the 2nd Category Link. Here are all of the plugins installed on my test site:

    • Akismet
    • Allin1 Migration
    • Create Block Theme
    • Duplicator
    • Kadence Blocks
    • Modula
    • Ninja Forms
    • Responsive Lightbox & Gallery
    • Speed Optimizer
    • Wordfence
    • WP-Sweep
  4. pbiron commented on Mar 29, 2025

    @pbiron

    sorry, "vanilla" + a simple plugin that just registers a few custom taxonomies just to surface the issue.

  5. pbiron commented on Mar 29, 2025

    @pbiron

    @askdesign Responsive Lightbox & Gallery regsiters a taxonomy named rl_category. `

  6. askdesign commented on Mar 29, 2025

    @askdesign
    MemberAuthor

    Bingo! Good find @pbiron.
    A secondary issue with this Custom Category Link is figuring out how to use it. It's not intuitive. I'll have to play around and experiment to see how it works.

  7. pbiron commented on Mar 29, 2025

    @pbiron

    Attached is a simple plugin to demonstrate the problem.

    test-69749.zip

    WP: 6.7.2
    Theme: TT4
    Plugins: only the test-69749 plugin

    Steps to test:

    1. install/active the test plugin.
    2. add a few terms to each of the 2 custom taxonomies the plugin registers (the taxes are applied to post_type post)
    3. add a few terms to the core/built-in Category taxonomy
    4. edit a post and add a navigation block
    5. select that block (and the Block tab in the sidebar)
    6. click the "+" icon to add a navigation-item block
    7. in the "Search" box, enter "Category Link". You'll notice that 3 blocks appear in the inserter, one of which has the "4 boxes" icon, the other 2 have the "* with 2 lines below" icon
    8. select the block with the "4 boxes" icon and choose one of the Category terms you added
    9. click the "+" icon to add a navigation-item block
    10. in the "Search" box, enter "Category Link" and choose one of the blocks with the "* with 2 lines below" icon and select one of the custom terms you added to that custom tax
    11. click the "+" icon to add a navigation-item block
    12. in the "Search" box, enter "Category Link" and choose the other blocks with the "* with 2 lines below" icon and select one of the custom terms you added to that custom tax

    See attached screengrab of the relevant steps above

    Image

    As you can see in the screengrab, it's impossible to tell which custom taxonomy is associated with each block with the "* with 2 lines below" icon in the insert until you select one ;-(

  8. t-hamano commented on Mar 31, 2025

    @t-hamano
    Contributor

    You can change the block name and description by using the item_link and item_link_description fields of the labels property. Example:

    add_action( 'init', static function () {
    	$args = array(
    		'labels'      => array(
    			'name'                  => __( 'Custom Tax', 'test' ),
    			// This property is used for the block name.
    			'item_link'             => __( 'Custom Tax Link', 'test' ),
    			// This property is used for the block description.
    			'item_link_description' => __( 'This is my custom taxonomy.', 'test' ),
    		),
    		'public'            => true,
    		'show_in_rest'      => true,
    	);
    	register_taxonomy( 'my_custom_tax', 'post', $args );
    } );

    Image

  9. added
    [Type] Help Request
    [Block] Navigation Link
    and removed
    [Type] Enhancement
    on Mar 31, 2025
  10. pbiron commented on Mar 31, 2025

    @pbiron

    Wow! Thanx Aki! I had no idea those lables existed!

    @askdesign Based on what @t-hamano says, this doesn't seem to be a problem with GB. Rather, it's a problem those plugins (or themes) that register custom taxes not suppling their own name for the block variation. So, you probably will want to open an issue with the devs of Responsive Lightbox & Gallery and ask them to add those lables ;-)

  11. t-hamano commented on Mar 31, 2025

    @t-hamano
    Contributor

    As the reported issue is not a bug and I don't think there is anything we can do about it, I would like to close it.

  12. pbiron commented on Mar 31, 2025

    @pbiron

    @t-hamano Do you think it would be worthwhile opening another issue and to propose that in the absence of a link_item label, that the block variation name be singular_name + ' Link'?

  13. t-hamano commented on Mar 31, 2025

    @t-hamano
    Contributor

    "singular_name" + ' Link'

    This format may not be ideal for localization. See #29095 (comment)

  14. pbiron commented on Mar 31, 2025

    @pbiron

    yup, I was wondering that myself, but thought I'd ask. thanx

  15. askdesign commented on Mar 31, 2025

    @askdesign
    MemberAuthor

    Thank you all! I've reported the issue to the plugin devs.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Navigation Link[Type] Help Request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions