Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Wordpress

WordPress: Fix Block Patterns Registering Twice After a Theme Switch

- 01.12.26 - ErcanOPAK

📝 Fix Block Patterns Registering Twice After a Theme Switch

A block pattern registered via register_block_pattern() in both a parent theme’s functions.php and a child theme that extends it (a common copy-paste-and-modify mistake when customizing a starter theme) ends up registered under the same pattern slug twice — WordPress doesn’t error on the duplicate registration, but the pattern then shows up twice in the inserter, and editors have no way to tell which of the two identical-looking entries is the one actually being maintained going forward.

🔎 The Problem

// parent-theme/functions.php
register_block_pattern('mytheme/hero-banner', $args);

// child-theme/functions.php (meant to override, but copy-pasted
// instead of using unregister_block_pattern() first)
register_block_pattern('mytheme/hero-banner', $modified_args);
// Result: pattern appears TWICE in the inserter under the same name

✅ Fix: Unregister Before Re-Registering, Don’t Just Add Again

  • In the child theme, call unregister_block_pattern('mytheme/hero-banner') before registering the modified version, so the override actually replaces the parent’s pattern instead of sitting alongside it.
  • Hook both the unregister and re-register calls to init with a priority that guarantees the child theme’s code runs after the parent’s registration has already happened.
  • Audit functions.php in both parent and child themes for every register_block_pattern() call and confirm each slug appears exactly once across the two files combined.

A child theme is supposed to override its parent, not just add another voice saying the same thing twice.

— WordPress Admin

Related posts:

WordPress — wp_options Autoload Kills TTFB

WordPress — wp_options Autoload Kills TTFB

WordPress — REST API Auth Failures Behind CDN

WordPress — REST API Auth Failures Behind CDN

WordPress: Disable Post Revisions to Reduce Database Bloat

WordPress: Disable Post Revisions to Reduce Database Bloat

Views: 0
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Ajax: Fix a Beacon Request Silently Dropped on Page Unload
SQL Server: Fix an XML Index Rebuild Timing Out Nightly

Leave a Reply Cancel reply

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

Most Read

  1. 01How to make theater mode the default for Youtube 1,079 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 671 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 584 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 561 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com