Skip to content

Block Pattern category Duplicates term with different slug #69078

@jigneshnakrani088

Description

@jigneshnakrani088

Description

When registering a new pattern category with / as per Developer Docs, i.e themeslug/custom and when I select "Add new pattern" and select the category from the list, the slug is themeslug-custom which is a new category(duplicate) with same Name.

This has been reported in Trac Ticket; as per suggestion reporting the issue here.

Step-by-step reproduction instructions

  1. Register a block pattern category and pattern as per docs,
add_action( 'init', 'themeslug_register_pattern_categories' );

function themeslug_register_pattern_categories() {
	register_block_pattern_category( 'themeslug/custom', array( 
		'label'       => __( 'Theme Name: Custom', 'themeslug' ),
		'description' => __( 'Custom patterns for Theme Name.', 'themeslug' )
	) );
}

Now try adding the themeslug/custom category to any block pattern:

<?php
/**
 * Title: Hero
 * Slug: themeslug/hero
 * Categories: featured, themeslug/custom
 */
?>
<!-- Your block markup goes here. -->
  1. Go to Appearance > Editor > Patterns and select the specific pattern (the slug is themeslug%2Fcustom)
  2. Select "Add new pattern" or Duplicate any existing pattern
  3. And select Theme Name: Custom category from the list,
    • The pattern will have a new category assigned and the slug will be themeslug-custom
    • Will have two categories with the same name but with different slugs.

Screenshots, screen recording, code snippet

Image

Environment info

  • WordPress: 6.8-alpha
  • Theme: Twenty Twenty-Four

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions