• Resolved Julian

    (@juliangk)


    Hello,

    ever since installing WP 6.6 there are problems with patterns in custom block themes.
    I have been working for a while with custom block themes and have always created patterns in the theme through creating files within the folder “patterns”, such as “cover-with-text.php” and never had any issues having the patterns load in the backend in the pattern window within the gutenberg editor.

    I noticed that some of the Block API properties for patterns are different now in the Twenty Twenty-Four theme, as here:

    <?php
    /**
    * Title: Hero
    * Slug: twentytwentyfour/banner-hero
    * Categories: banner, call-to-action, featured
    * Viewport width: 1400
    * Description: A hero section with a title, a paragraph, a CTA button, and an image.
    */
    ?>

    Before there used to be keywords and no viewportWidth . I have changed my pattersn accordingly. But now whenever I add a new pattern it doesn’t show in the editor. Then while error logging and reloading, minutes later they appear for no apparent reason. Then the whole problem starts again when I add a new pattern.

    I have not managed to debug the problem, can not find the reason and also do not know why sometimes they suddenly start loading/registering and sometimes they don’t. Changing priority in the hook where I add my custom categroy does nothing:

    add_action('init', function () {

    //**** Unregister Core Patterns ****/
    unregister_block_pattern_category('featured');
    unregister_block_pattern_category('footer');
    unregister_block_pattern_category('query');
    unregister_block_pattern_category('posts');
    unregister_block_pattern_category('testimonials');
    unregister_block_pattern_category('text');
    unregister_block_pattern_category('services');

    //**** Register Pattern Category ****/
    register_block_pattern_category(
    'example',
    array('label' => 'Example')
    );

    });

    What could be causing these issues? How can I make sure my patterns are being recognized and loaded without registering them through php directly?

    Thanks and best regards
    Julian

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.