pattern-directory icon indicating copy to clipboard operation
pattern-directory copied to clipboard

Handle changing pattern category names

Open ryelle opened this issue 2 years ago • 4 comments

See https://github.com/WordPress/gutenberg/issues/44501, https://github.com/WordPress/gutenberg/pull/44203

The pattern categories are being rethought, so the names will be changing. The Pattern Directory provides patterns for multiple WP versions, but the categories themselves are hardcoded into each version. If the names update, sites who aren't using the latest Gutenberg would get a bunch of Uncategorized patterns.

This came up with the Banner category, where it was deemed OK, but if we're changing multiple categories that seems like a bad experience.

ryelle avatar Oct 26 '22 16:10 ryelle

"Query" will be changed to "Posts" when GB 14.5 is released, so w.org/patterns will need a solution for then

ref https://github.com/WordPress/gutenberg/pull/45244

ryelle avatar Oct 31 '22 16:10 ryelle

In my mind, we can create a mapper for previous category names with new ones and swap them while we show them in different parts of the UI. I haven't tested anything yet, but seems simple enough and similar to the blocks renaming handle we have, like the renamed embed or social blocks that got merged under one main block with variations.

ntsekouras avatar Nov 13 '22 11:11 ntsekouras

That sounds like a good way for Gutenberg to handle older plugins/themes that register blocks with the old labels 👍🏻

For WP sites that aren't using Gutenberg (so just plain WP 6.1), if we update the categories for the Core & Featured patterns, they won't have those new categories. For example, a pattern that used to be "buttons" is now "call to action", but the non-GB site doesn't know "call to action". Is it OK that these will be "Uncategorized"? I suppose it's only 8 patterns that are "core" but not "featured", and the rest of the "featured" ones would stay in the Featured category.

Edit: Maybe this won't be necessary, waiting on some feedback from #190

ryelle avatar Nov 15 '22 17:11 ryelle

For WP sites that aren't using Gutenberg (so just plain WP 6.1), if we update the categories for the Core & Featured patterns, they won't have those new categories.

I'm not sure I get the problem.. Is it about the pattern creation UI in the directory? If yes, shouldn't a similar mapping in PD solve this as well? For example show in the UI, the new category, but during creation also add the old one. In WP sites now it will be shown only to the categories that are registered, depending on the usage of GB or not.

ntsekouras avatar Nov 16 '22 07:11 ntsekouras