• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP Bitz

A curated collection of code snippets for WordPress

  • Home
  • About
  • Blog
  • Code Snippets
You are here: Home / WordPress Development Tips / Notice: Function WP_Block_Patterns_Registry::register was called incorrectly

Notice: Function WP_Block_Patterns_Registry::register was called incorrectly

WordPress Development Tips · May 12, 2025

This post brought to you by RocketGeek, ButlerBlog, and the following:

 

This PHP error in WordPress is a result of an invalid transient in WooCommerce.

This 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 error message.

You don’t have WooCommerce installed, you say? Doesn’t matter – many plugins leave behind their transients in the database whether they are used or not. If you ever had WooCommerce installed, you may have this transient remaining in your database.

I have had this error occur when migrating sites from production to staging and vice versa. It could pop up in these dev situations, and if you’re unaware of this issue with its simple solution, you could be chasing ghosts for a long time before you find it.

Here is the quick solution: Run the following query in MySQL:

DELETE FROM wp_options WHERE option_name = '_site_transient_woocommerce_blocks_patterns';

Alternatively (or in addition to the above), you can run the following WP CLI command:

wp transient delete woocommerce_blocks_patterns

Filed Under: WordPress Development Tips Tagged With: mysql, woocommerce, wp-errors

Chad Butler

This post brought to you by RocketGeek, ButlerBlog, and the following:

 

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Join for free!

Get free code snippets, WordPress best practices, and practical Content Marketing advice from seasoned WordPress expert Chad Butler (butlerblog):

Recent Posts

  • Add a Database Connection to use WPDB
  • Notice: Function WP_Block_Patterns_Registry::register was called incorrectly
  • Use WP-CLI to back up your site
  • Bitnami WordPress Autoptimize cannot write to the cache directory
  • Create and delete WordPress sites in XAMPP with a batch file

Copyright © 2025 · Maker Pro on Genesis Framework · WordPress · Log in