I have created a bunch of blocks, and every time I have saved it as a pattern by selecting the block in the list view > three dots > Create pattern. All these patterns appeared in a new category 'My patterns' which WP apparently created, because I certainly didn't.

overview of pattern categories

Now, however, I created another block in a php-file with this header:

 * Title: Banner Page Title
 * Slug: twentytwentyfour-child/banner-page-title
 * Categories: banner, featured, my-patterns

The pattern does appear in the category banner and featured, but not in My patterns. I tried my-patterns but that did not work, nor did my-pattern. So, I turned to ChatGPT who said that I needed to register the category, so I did with this in the functions.php:

// register my patterns function
register_custom_pattern_category() {
    if ( function_exists('register_block_pattern_category') ) {
            'my-patterns', // Slug van de categorie
            array('label' => __('My patterns', 'twentytwentyfour-child')) // Label dat in de editor wordt getoond
add_action('init', 'register_custom_pattern_category');

Result: When I now go to Appearance > Editor > Patterns, I see I have "My Patterns" twice:

Editor categories

That pattern that I created in the php file is sitting alone in the second My patterns, but I want it with the others in the first My patterns. How do I do this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.