Title: WP_REST_View_Config_Controller::get_required_capability
Published: August 20, 2026

---

# WP_REST_View_Config_Controller::get_required_capability( string $kind, string $name ): string|null

## In this article

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

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

Resolves the capability required to read the view config for an entity.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_required_capability/?output_format=md#description)󠁿

Known kinds map to the capability that gates managing that entity’s list: post types
use their own `edit_posts` capability (which honors custom `capability_type` registrations),
taxonomies use `manage_terms`, and root-level entities use `manage_options`. A post
type or taxonomy that is not registered, or not exposed to the REST API, resolves
to `null` so the request is treated as referencing an unknown entity.

Any other kind falls back to `edit_posts`. This keeps entities registered through
the `get_entity_view_config_{$kind}_{$name}` filter readable behind a baseline capability.

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

 `$kind`stringrequired

The entity kind (e.g. `postType`).

`$name`stringrequired

The entity name (e.g. `page`).

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

 string|null Capability required to read the config, or null if the entity is not
registered.

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

    ```php
    protected function get_required_capability( $kind, $name ) {
    	switch ( $kind ) {
    		case 'postType':
    			$post_type = get_post_type_object( $name );
    			if ( $post_type && $post_type->show_in_rest ) {
    				return $post_type->cap->edit_posts;
    			}
    			return null;

    		case 'taxonomy':
    			$taxonomy = get_taxonomy( $name );
    			if ( $taxonomy && $taxonomy->show_in_rest ) {
    				return $taxonomy->cap->manage_terms;
    			}
    			return null;

    		case 'root':
    			return 'manage_options';
    	}

    	return 'edit_posts';
    }
    ```

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

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

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

Retrieves the taxonomy object of $taxonomy.

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

Retrieves a post type object by name.

  |

| Used by | Description | 
| [WP_REST_View_Config_Controller::get_items_permissions_check()](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_items_permissions_check/)`wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php` |

Checks if a given request has access to read view config.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_required_capability/?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%2Fclasses%2Fwp_rest_view_config_controller%2Fget_required_capability%2F)
before being able to contribute a note or feedback.