bricks_get_global_queries
Overview
List all saved global queries from the Bricks design system. Global queries (introduced in Bricks v2.1) are reusable query configurations stored centrally and referenced by any element with a query loop across the entire site.
Instead of configuring the same query parameters on every page, create a global query once and reference it by ID. When you update the global query, all elements referencing it automatically use the updated settings.
Key Features
When to Use
Finding the ID of a global query to reference in bricks_set_query_loop
Auditing query configurations across the site for consistency
Filtering queries by category or object type to find specific ones
At least one global query must exist (created via bricks_create_global_query)
When NOT to Use
You want to see the query results/data — global queries are configurations, not data
Listing queries configured inline on elements — this only shows globally saved queries
Parameters
categorystringoptionalobject_typestringoptionalall Values: post, term, user, api, allCode Examples
Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12
List all post-type global queries
Retrieve only global queries that query WordPress posts/CPTs.
// Get all post queries
const queries = await bricks_get_global_queries({
object_type: "post"
});
// Returns:
// [
// { id: "gq_abc123", label: "Latest Blog Posts", query: { objectType: "post", post_type: "post", posts_per_page: 6 } },
// { id: "gq_def456", label: "Featured Products", query: { objectType: "post", post_type: "product", meta_query: [...] } }
// ]
// Reference a global query in a query loop:
bricks_set_query_loop({
page_id: 123,
element_id: "loop-item",
query: { useGlobalQuery: "gq_abc123" }
});Common Mistakes
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Tips & Warnings
Use global queries for consistency. If the same query (e.g., « latest 6 blog posts ») appears on multiple pages, create it as a global query once and reference it everywhere.
The returned query ID is used in bricks_set_query_loop via { useGlobalQuery: "<id>" } to connect an element to the global query.