W3cubDocs

/WordPress

build_query( array $data ): string

Builds URL query based on an associative and, or indexed array.

Description

This is a convenient function for easily building url queries. It sets the separator to ‘&’ and uses _http_build_query() function.

See also

Parameters

$dataarrayrequired
URL-encode key/value pairs.

Return

string URL-encoded string.

Source

function build_query( $data ) {
	return _http_build_query( $data, null, '&', '', false );
}

Changelog

Version Description
2.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/build_query