/**
* Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included.
*
* @since 5.0.0
*
* @param string|array $subtypes One or more subtypes.
* @param WP_REST_Request $request Full details about the request.
* @param string $parameter Parameter name.
* @return string[]|WP_Error List of valid subtypes, or WP_Error object on failure.
*/
public function sanitize_subtypes( $subtypes,
$request,
$parameter ) { $subtypes =
wp_parse_slug_list( $subtypes );
$subtypes =
rest_parse_request_arg( $subtypes,
$request,
$parameter );
if ( is_wp_error( $subtypes ) ) { return $subtypes;
} // 'any' overrides any other subtype.
if ( in_array( self::TYPE_ANY,
$subtypes, true
) ) { return array
( self::TYPE_ANY
);
}