Skip to main content

Function: getQueryArgs()

getQueryArgs(url): Record<string, any>

Defined in: packages/core/src/utils/url.ts:78

Returns an object of query arguments of the given URL. If the given URL is invalid or has no querystring, an empty object is returned.

Parameters​

url​

string

URL.

Returns​

Record<string, any>

Query args object.

Example​

const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );
// { "foo": "bar", "bar": "baz" }