Search commands
The bricks search command lets you find elements across your entire site. Search by element type, global class, setting value, post type, or Bricks query metadata. Useful for auditing content, finding query loops, locating WooCommerce product grids, or understanding what exists before making changes.
Basic usage
Section titled “Basic usage”bricks search elements [flags]You can run it without filters, but it is usually more useful to combine filters so the result set stays small enough for people and agents to reason about.
| Flag | Description |
|---|---|
--type <type> | Filter by element type (heading, button, image, etc.) |
--class <class> | Filter by global class name |
--setting <key=value> | Filter by a specific setting and value |
--post-type <type> | Limit to a post type: page, template, etc. |
--has-query | Only return elements with Bricks query settings |
--query-object-type <type> | Filter query elements by object type |
--query-post-type <type> | Filter query elements by queried post type |
--query-taxonomy <taxonomy> | Filter query elements by queried taxonomy |
--limit <N> | Maximum number of results to return |
--format json | Output as JSON instead of the default table |
--json | Shorthand for --format json |
Find by element type
Section titled “Find by element type”bricks search elements --type headingPage Element ID Type Tag Text1460 abc123 heading h1 Welcome to Acme1460 def456 heading h2 Our Services1523 ghi789 heading h1 About Us1523 jkl012 heading h3 Our Team1587 mno345 heading h1 ContactThis returns every heading element across all pages, templates, and components.
Find by global class
Section titled “Find by global class”Track down everywhere a specific class is used.
bricks search elements --class fr-heroPage Element ID Type Classes1460 abc123 section fr-hero, section--l1523 xyz789 section fr-hero, bg--primary-darkWorks with ACSS utility classes, Frames component classes, and any custom global classes.
Find by setting value
Section titled “Find by setting value”Search for elements with a specific setting.
bricks search elements --setting tag=h1Page Element ID Type Text1460 abc123 heading Welcome to Acme1523 ghi789 heading About Us1587 mno345 heading ContactEvery h1 on the site, in one command. Handy for checking heading hierarchy.
Filter by post type
Section titled “Filter by post type”Narrow results to just pages, or just templates.
bricks search elements --type button --post-type pagePage Element ID Type Text1460 pqr678 button Get Started1460 stu901 button Learn More1523 vwx234 button Contact UsCombine filters
Section titled “Combine filters”Stack multiple flags to get specific.
bricks search elements --type heading --setting tag=h1 --post-type pageThis finds all h1 headings, but only on pages (not templates or components).
Find query-driven sections
Section titled “Find query-driven sections”bricks search elements --has-queryThis returns elements that have Bricks query data or loop settings attached, regardless of whether they are classic post loops or WooCommerce product lists.
Find WooCommerce product loops
Section titled “Find WooCommerce product loops”bricks search elements --has-query --query-post-type productThis is the fastest way to find existing product grids, related-product sections, or custom loops that query the product post type.
You can narrow it further by taxonomy:
bricks search elements --has-query --query-post-type product --query-taxonomy product_catLimit results
Section titled “Limit results”bricks search elements --type image --limit 5Returns at most 5 matching elements.
JSON output
Section titled “JSON output”bricks search elements --has-query --query-post-type product --limit 3 --json{ "results": [ { "postId": 1460, "postTitle": "Shop", "postType": "page", "elementId": "abc123", "elementType": "posts", "elementLabel": "Featured products", "settings": { "hasLoop": true, "query": { "objectType": "post", "post_type": ["product"] } }, "parentId": "0", "hasQuery": true, "queryObjectType": "post", "queryPostTypes": ["product"], "queryTaxonomies": [], "queryRaw": { "objectType": "post", "post_type": ["product"] } } ], "total": 1, "page": 1, "perPage": 3, "totalPages": 1}JSON output is what you’ll want when piping results into another tool or feeding them to an AI agent.
Practical uses
Section titled “Practical uses”Audit heading structure across the site:
bricks search elements --type heading --json | jq '.results[].settings.tag' | sort | uniq -cOn Windows,
jq,sort, anduniqare not built-in. Install jq separately, or use PowerShell:Terminal window bricks search elements --type heading --json | ConvertFrom-Json | Select-Object -ExpandProperty results | Group-Object { $_.settings.tag } | Select-Object Count, Name
Find all buttons linking to a specific URL:
bricks search elements --type button --setting link=/pricingCheck which pages use a particular component class:
bricks search elements --class fr-pricing-tableCount images across all pages:
bricks search elements --type image --json | jq '.results | length'Related commands
Section titled “Related commands”bricks site pull: pull full page content once you’ve found what you’re looking forbricks site query-elements: list the Bricks element types that support queriesbricks woo products: inspect WooCommerce content directlybricks classes find: search for global class definitions (not usages)bricks doctor: find structural problems on a specific page