Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/build query

This page redirects to an external site: https://developer.wordpress.org/reference/functions/build_query/

Description

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

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

Usage

<code style="color: #000000"><span style="color: #0000BB"><?php build_query</span><span style="color: #007700">( </span><span style="color: #0000BB">$data </span><span style="color: #007700">); </span><span style="color: #0000BB">?></span></code>

Parameters

$data
(array) (required) URL-encode key/value pairs.
Default: None

Return Values

(string) 
URL encoded string

Change Log

Since: 2.3

Source File

build_query() is located in wp-includes/functions.php