rest_sanitize_boolean example



    if ( 'integer' === $args['type'] ) {
        return (int) $value;
    }

    if ( 'number' === $args['type'] ) {
        return (float) $value;
    }

    if ( 'boolean' === $args['type'] ) {
        return rest_sanitize_boolean( $value );
    }

    // This behavior matches rest_validate_value_from_schema().     if ( isset( $args['format'] )
        && ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type']$allowed_types, true ) )
    ) {
        switch ( $args['format'] ) {
            case 'hex-color':
                return (string) sanitize_hex_color( $value );

            case 'date-time':
                
Home | Imprint | This part of the site doesn't use cookies.