• Resolved ghislefou

    (@ghislefou)


    Hi WooCommerce,

    I have a question regarding doing_it_wrong message I have in Query Monitor on my website.
    It is running woocommerce v9.7.1 and I have a lot (37 messages) of:
    Function WP_Block_Patterns_Registry::register was called incorrectly. Pattern content must be a string. (This message was added in version 5.5.0.)

    After dumping where it comes from, I could see that it was from a whole list of Block patterns I’m not using:

    "woocommerce-blocks/banner"
    "woocommerce/coming-soon-entire-site"
    "woocommerce/coming-soon-store-only"
    "woocommerce/coming-soon"
    "woocommerce-blocks/content-right-with-image-left"
    "woocommerce-blocks/featured-category-cover-image"
    "woocommerce-blocks/featured-category-triple"
    "woocommerce-blocks/product-filters"
    "woocommerce-blocks/footer-large"
    "woocommerce-blocks/footer-simple-menu"
    "woocommerce-blocks/footer-with-3-menus"
    "woocommerce-blocks/form-image-grid-content-left"
    "woocommerce-blocks/header-centered-menu"
    "woocommerce-blocks/header-distraction-free"
    "woocommerce-blocks/header-essential"
    "woocommerce-blocks/header-large"
    "woocommerce-blocks/header-minimal"
    "woocommerce-blocks/heading-with-three-columns-of-content-with-link"
    "woocommerce-blocks/hero-product-3-split"
    "woocommerce-blocks/hero-product-chessboard"
    "woocommerce-blocks/hero-product-split"
    "woocommerce-blocks/centered-content-with-image-below"
    "woocommerce-blocks/just-arrived-full-hero"
    "woocommerce/no-products-found-clear-filters"
    "woocommerce/no-products-found"
    "woocommerce-blocks/product-collection-3-columns"
    "woocommerce-blocks/product-collection-4-columns"
    "woocommerce-blocks/product-collection-5-columns"
    "woocommerce-blocks/product-collection-featured-products-5-columns"
    "woocommerce-blocks/product-query-product-gallery"
    "woocommerce/product-search-form"
    "woocommerce-blocks/related-products"
    "woocommerce-blocks/social-follow-us-in-social-media"
    "woocommerce-blocks/testimonials-3-columns"
    "woocommerce-blocks/testimonials-single"
    "woocommerce-blocks/three-columns-with-images-and-content"

    I’m not using using them since we are running a custom theme.

    Is there a way to get rid properly from these messages, like deactivating these block patterns from the UI or whatever?

    Thanks for your help.

    Best

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @ghislefou,

    Thanks for reaching out!

    The warning you’re seeing—Function WP_Block_Patterns_Registry::register was called incorrectly. Pattern content must be a string.—is a known issue in WooCommerce, caused by how block pattern content is cached internally. Even if you’re not using these patterns, WooCommerce still registers them, and if the content isn’t a string (e.g., due to how paths are stored in the cache), it triggers that message in tools like Query Monitor.

    As a workaround, you can clear the cached block patterns after deployment by running the following query:

    DELETE FROM wp_options WHERE option_name = '_site_transient_woocommerce_blocks_patterns';

    If you’re using an object or database caching plugin like W3 Total Cache, be sure to clear the cache as well afterward.

    This will remove the invalid entries and eliminate the warning. The long-term solution is for WooCommerce to cache relative paths instead of absolute ones—which is already being discussed on GitHub here: https://github.com/woocommerce/woocommerce/issues/53345

    Thread Starter ghislefou

    (@ghislefou)

    Hi there,

    Thank you so much for your answer, let me test it.
    I have another question regarding the number of queries that are made on every request on the back office for example.
    I can see some queries like related to:

    • woocommerce_custom_orders_table_data_sync_enabled
    • wc_feature_woocommerce_brands_enabled
    • wc_brands_show_description
    • woocommerce_show_marketplace_suggestions
    • woocommerce_pickup_location_settings
    • woocommerce_flat_rate_settings
    • woocommerce_free_shipping_settings
    • woocommerce_international_delivery_settings

    like:

    SELECT option_value
    FROM wp_options
    WHERE option_name = 'woocommerce_international_delivery_settings'
    LIMIT 1

    They seems to be related to woocommerce features we are not using.
    Is there a way to get rid of these DB queries if the feature is not used?

    Thanks for your help.

    Best,

    Hi @ghislefou,

    Many of these database queries are part of how WooCommerce checks feature availability and loads settings, even if the specific features aren’t actively in use. At the moment, there isn’t a built-in way to disable these checks selectively.

    That said, WooCommerce is always evolving, and performance improvements are ongoing. If this is causing a noticeable impact, you might consider using an object caching solution like Redis or Memcached to reduce the load from repeated queries.

    For more advanced customization, we’d recommend consulting with a developer or joining our WooCommerce Community Slack for ideas and guidance from others who may have tackled similar use cases.

    Plugin Support Kay U a11n

    (@kingsleyinfo)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

    If you have a few minutes, we’d love if you could leave us a review: https://wordpress.org/support/plugin/woocommerce/reviews/

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WP_Block_Patterns_Registry::register was called incorrectly’ is closed to new replies.