Title: get_default_block_categories
Published: July 20, 2021
Last modified: April 28, 2025

---

# get_default_block_categories(): array[]

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#wp--skip-link--target)

Returns the list of default categories for block types.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#return)󠁿

 array[] Array of categories for block types.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#source)󠁿

    ```php
    function get_default_block_categories() {
    	return array(
    		array(
    			'slug'  => 'text',
    			'title' => _x( 'Text', 'block category' ),
    			'icon'  => null,
    		),
    		array(
    			'slug'  => 'media',
    			'title' => _x( 'Media', 'block category' ),
    			'icon'  => null,
    		),
    		array(
    			'slug'  => 'design',
    			'title' => _x( 'Design', 'block category' ),
    			'icon'  => null,
    		),
    		array(
    			'slug'  => 'widgets',
    			'title' => _x( 'Widgets', 'block category' ),
    			'icon'  => null,
    		),
    		array(
    			'slug'  => 'theme',
    			'title' => _x( 'Theme', 'block category' ),
    			'icon'  => null,
    		),
    		array(
    			'slug'  => 'embed',
    			'title' => _x( 'Embeds', 'block category' ),
    			'icon'  => null,
    		),
    		array(
    			'slug'  => 'reusable',
    			'title' => _x( 'Patterns', 'block category' ),
    			'icon'  => null,
    		),
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/block-editor.php#L18)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/block-editor.php#L18-L56)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#related)󠁿

| Uses | Description | 
| [_x()](https://developer.wordpress.org/reference/functions/_x/)`wp-includes/l10n.php` |

Retrieves translated string with gettext context.

  |

| Used by | Description | 
| [get_default_block_editor_settings()](https://developer.wordpress.org/reference/functions/get_default_block_editor_settings/)`wp-includes/block-editor.php` |

Returns the default block editor settings.

  | 
| [get_block_categories()](https://developer.wordpress.org/reference/functions/get_block_categories/)`wp-includes/block-editor.php` |

Returns all the categories for block types that will be shown in the block editor.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.3.0](https://developer.wordpress.org/reference/since/6.3.0/) | Reusable Blocks renamed to Patterns. | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_default_block_categories/?output_format=md#comment-content-6622)
 2.    [Huzaifa Al Mesbah](https://profiles.wordpress.org/huzaifaalmesbah/)  [  3 years ago  ](https://developer.wordpress.org/reference/functions/get_default_block_categories/#comment-6622)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_default_block_categories%2F%23comment-6622)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_default_block_categories%2F%23comment-6622)
 4.  This code defines a function called `get_default_block_categories()`that returns
     an array of default block categories for a block-based content editor, like the
     one used in WordPress’s Gutenberg editor. Block-based editors allow users to create
     content by assembling different types of “blocks,” such as text, images, videos,
     and more. These blocks are categorized to make it easier for users to find and
     use them. Let’s break down the code step by step:
 5.  The function is defined using the function keyword: `function get_default_block_categories(){...}`.
     This function doesn’t take any arguments and will return an array of block categories.
 6.  Inside the function, an array is defined that holds information about each block
     category. Each block category is represented as an associative array with three
     keys: `'slug', 'title', and 'icon'`.
 7.  The `'slug'` key is a short identifier for the block category. It’s used to uniquely
     identify and reference the category.
      The ‘`title'` key holds the display name
     of the block category. The `_x() `function is used for localization, allowing 
     the block category name to be translated into different languages. The `'icon'`
     key represents the icon associated with the block category. In this code snippet,
     the value is null, indicating that no specific icon is assigned to these categories.
     The array contains seven block category definitions, each with a unique `'slug'`,
     a localized `'title'`, and a null `'icon'`.
 8.  `'text'`: Represents a category for text-related blocks.
      `'media'`: Represents
     a category for media-related blocks, such as images and videos. `'design'`: Represents
     a category for design-related blocks. `'widgets'`: Represents a category for widget-
     related blocks. `'theme'`: Represents a category for blocks related to the overall
     theme of the content. `'embed'`: Represents a category for embed-related blocks,
     like embedding external content. `'reusable'`: Represents a category for reusable
     pattern blocks. After defining all the block categories in the array, the function
     ends with a closing curly brace: }.
 9.  When this function is called, it will return an array containing these default
     block categories, which can then be used by a block-based content editor to organize
     and present different types of content blocks to the user in a structured manner.
 10.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_default_block_categories%2F%3Freplytocom%3D6622%23feedback-editor-6622)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_default_block_categories%2F)
before being able to contribute a note or feedback.