Title: _wp_get_entity_view_config_posttype_wp_block
Published: August 20, 2026

---

# _wp_get_entity_view_config_posttype_wp_block( WP_View_Config_Data $data ): 󠀁[WP_View_Config_Data](https://developer.wordpress.org/reference/classes/wp_view_config_data/)󠁿

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#changelog)

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

Provides the view configuration for the `wp_block` post type.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#parameters)󠁿

 `$data`[WP_View_Config_Data](https://developer.wordpress.org/reference/classes/wp_view_config_data/)
required

The view configuration container for the entity.

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

 [WP_View_Config_Data](https://developer.wordpress.org/reference/classes/wp_view_config_data/)
The updated view configuration container.

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

    ```php
    function _wp_get_entity_view_config_posttype_wp_block( $data ) {
    	$default_layouts = array(
    		'table' => array(
    			'layout' => array(
    				'styles' => array(
    					'author' => array(
    						'width' => '1%',
    					),
    				),
    			),
    		),
    		'grid'  => array(
    			'layout' => array(
    				'badgeFields' => array( 'sync-status' ),
    			),
    		),
    	);

    	$default_view = array(
    		'type'       => 'grid',
    		'perPage'    => 20,
    		'titleField' => 'title',
    		'mediaField' => 'preview',
    		'fields'     => array( 'sync-status' ),
    		'filters'    => array(),
    		'layout'     => $default_layouts['grid']['layout'],
    	);

    	$view_list = array(
    		array(
    			'title' => __( 'All patterns' ),
    			'slug'  => 'all-patterns',
    		),
    		array(
    			'title' => __( 'My patterns' ),
    			'slug'  => 'my-patterns',
    		),
    	);

    	// Gather categories from the block pattern categories registry.
    	$registry   = WP_Block_Pattern_Categories_Registry::get_instance();
    	$categories = array();

    	foreach ( $registry->get_all_registered() as $category ) {
    		$categories[ $category['name'] ] = $category['label'];
    	}

    	// Ensure "Uncategorized" is always included for patterns
    	// that have no category assigned.
    	$categories['uncategorized'] ??= __( 'Uncategorized' );

    	// Also gather user-created pattern categories (wp_pattern_category taxonomy).
    	$user_terms = get_terms(
    		array(
    			'taxonomy'   => 'wp_pattern_category',
    			'hide_empty' => false,
    		)
    	);

    	if ( ! is_wp_error( $user_terms ) ) {
    		foreach ( $user_terms as $term ) {
    			$categories[ $term->slug ] = $term->name;
    		}
    	}

    	// Sort categories alphabetically by label.
    	asort( $categories, SORT_NATURAL | SORT_FLAG_CASE );

    	foreach ( $categories as $category_name => $label ) {
    		$view_list[] = array(
    			'title' => $label,
    			'slug'  => $category_name,
    		);
    	}

    	$form = array(
    		'layout' => array( 'type' => 'panel' ),
    		'fields' => array(
    			array(
    				'id'     => 'excerpt',
    				'layout' => array(
    					'type'          => 'panel',
    					'labelPosition' => 'top',
    				),
    			),
    			array(
    				'id'     => 'post-content-info',
    				'layout' => array(
    					'type'          => 'regular',
    					'labelPosition' => 'none',
    				),
    			),
    			'sync-status',
    			'revisions',
    		),
    	);

    	$data->set(
    		array(
    			'default_view'    => $default_view,
    			'default_layouts' => $default_layouts,
    			'view_list'       => $view_list,
    			'form'            => $form,
    		),
    		1
    	);

    	return $data;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/view-config.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/view-config.php#L330)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/view-config.php#L330-L438)

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

| Uses | Description | 
| [WP_Block_Pattern_Categories_Registry::get_instance()](https://developer.wordpress.org/reference/classes/wp_block_pattern_categories_registry/get_instance/)`wp-includes/class-wp-block-pattern-categories-registry.php` |

Utility method to retrieve the main instance of the class.

  | 
| [get_terms()](https://developer.wordpress.org/reference/functions/get_terms/)`wp-includes/taxonomy.php` |

Retrieves the terms in a given taxonomy or list of taxonomies.

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

Retrieves the translation of $text.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_wp_get_entity_view_config_posttype_wp_block/?output_format=md#)

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

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

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