wp/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    82 	 *
    82 	 *
    83 	 * @param WP_REST_Request $request Full details about the request.
    83 	 * @param WP_REST_Request $request Full details about the request.
    84 	 * @return true|WP_Error True if the current user has permission, WP_Error object otherwise.
    84 	 * @return true|WP_Error True if the current user has permission, WP_Error object otherwise.
    85 	 */
    85 	 */
    86 	protected function check_has_read_only_access( $request ) {
    86 	protected function check_has_read_only_access( $request ) {
       
    87 		/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php */
       
    88 		$read_only_access = apply_filters( 'rest_menu_read_access', false, $request, $this );
       
    89 		if ( $read_only_access ) {
       
    90 			return true;
       
    91 		}
       
    92 
    87 		if ( current_user_can( 'edit_theme_options' ) ) {
    93 		if ( current_user_can( 'edit_theme_options' ) ) {
    88 			return true;
    94 			return true;
    89 		}
    95 		}
    90 
    96 
    91 		if ( current_user_can( 'edit_posts' ) ) {
    97 		if ( current_user_can( 'edit_posts' ) ) {