build_query – WordPress function

The build_query is a WordPress standard function. The build_query function can be used for building URL queries. The & character is used as a parameter separator.

Function Description

This function builds a URL query based on an associative/indexed array.

What does this function returns?

build_query returns a String. URL with request parameters.

Function Parameters

$ data (array) (required)
Key/value pairs from which builds query parameters for the URL.

Source of this function

wp-includes/functions.php

Notes

The opposite operation can be done using the wp_parse_str function.

Function examples

#1 Demonstration of the function

#2 Example of creating a request

Leave a comment