# Remove Pattern Categories You Do Not Use

> Removes the pattern categories you list (such as Gallery, Media or Portfolio) from the block inserter, so the pattern list is shorter and easier to scan.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: patterns, inserter, cleanup
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/remove-unused-pattern-categories/

## Code

```php
// Pattern category slugs to remove.
$wpide_pattern_categories_to_remove = array( 'gallery', 'media', 'portfolio', 'team' );

add_action( 'init', function () use ( $wpide_pattern_categories_to_remove ) {
    if ( ! class_exists( 'WP_Block_Pattern_Categories_Registry' ) ) {
        return;
    }

    $registry = WP_Block_Pattern_Categories_Registry::get_instance();

    foreach ( $wpide_pattern_categories_to_remove as $slug ) {
        if ( $registry->is_registered( $slug ) ) {
            unregister_block_pattern_category( $slug );
        }
    }
}, 999 );
```

## Notes

Category slugs include buttons, columns, gallery, header, footer, text, query, featured, call-to-action, team, testimonials, contact, about, portfolio, media, posts, banner.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Remove Pattern Categories You Do Not Use" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
