rest_parse_request_arg example


    public function sanitize_callback( $value$request$param ) {
        if ( is_null( $value ) ) {
            return $value;
        }

        return rest_parse_request_arg( $value$request$param );
    }

    /** * Recursively add additionalProperties = false to all objects in a schema * if no additionalProperties setting is specified. * * This is needed to restrict properties of objects in settings values to only * registered items, as the REST API will allow additional properties by * default. * * @since 4.9.0 * @deprecated 6.1.0 Use {@see rest_default_additional_properties_to_false()} instead. * * @param array $schema The schema array. * @return array */

    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 );
        }

        $handler = $this->get_search_handler( $request );
        if ( is_wp_error( $handler ) ) {
            
Home | Imprint | This part of the site doesn't use cookies.