Title: WP_REST_Plugins_Controller::get_items_permissions_check
Published: August 11, 2020
Last modified: May 20, 2026

---

# WP_REST_Plugins_Controller::get_items_permissions_check( WP_REST_Request $request ): true|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

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

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

Checks if a given request has access to get plugins.

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

 `$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)
required

Full details about the request.

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

 true|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/) True
if the request has read access, [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
object otherwise.

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

    ```php
    public function get_items_permissions_check( $request ) {
    	if ( ! current_user_can( 'activate_plugins' ) ) {
    		return new WP_Error(
    			'rest_cannot_view_plugins',
    			__( 'Sorry, you are not allowed to manage plugins for this site.' ),
    			array( 'status' => rest_authorization_required_code() )
    		);
    	}

    	return true;
    }
    ```

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

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

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

Returns a contextual HTTP error code for authorization failure.

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

Returns whether the current user has the specified capability.

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

Retrieves the translation of $text.

  | 
| [WP_Error::__construct()](https://developer.wordpress.org/reference/classes/wp_error/__construct/)`wp-includes/class-wp-error.php` |

Initializes the error.

  |

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

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

| Version | Description | 
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.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_plugins_controller%2Fget_items_permissions_check%2F)
before being able to contribute a note or feedback.