bricks_preview_url

UtilityBeginnerRead OnlyComplexity: 1/10
Get frontend, preview, and editor URLs for a page

Overview

Generates frontend, preview, and Bricks editor URLs for a given page. Works for both published and draft pages. Returns all URL variants so the agent or user can quickly access the page in the appropriate context — whether viewing the live page, a WordPress preview, or the Bricks visual editor.

Key Features

Multiple URL types
Returns frontend URL, WordPress preview URL (with nonce), and Bricks editor URL in a single call.
Draft page support
Generates valid preview URLs even for unpublished/draft pages.

When to Use

After creating or modifying a page to provide a link for the user to preview
When you need to open the Bricks editor for a specific page
When generating shareable preview links for draft pages
When building workflow responses that include actionable page URLs
Prerequisites
Page must exist (valid page_id)

When NOT to Use

When you need to inspect page content — use bricks_get_page_content or bricks_get_page_summary instead
When you need to check if a page exists — use bricks_list_pages instead

Parameters

1 Total Parameters1 Required
page_idnumberREQUIRED
Page ID to generate URLs for.

Code Examples


Warning: Undefined array key "example_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 10

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

Get all URLs for a page

JSON
{
  "tool": "bricks_preview_url",
  "params": {
    "page_id": 33
  }
}
Response
{
  "frontend_url": "https://example.com/",
  "preview_url": "https://example.com/?page_id=33&preview=true&nonce=abc123",
  "editor_url": "https://example.com/?bricks=run&post_id=33"
}

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
Draft pages are not accessible via their frontend URL. Use the preview_url instead, which includes the authentication nonce.

Tips & Warnings

Tips & Warnings

Agent workflow: Always call bricks_preview_url at the end of a page-building workflow and include the URLs in your response. This lets the user immediately preview or edit the page.

Return Values

FieldTypeDescription
frontend_urlstringThe public-facing URL of the page.
preview_urlstringWordPress preview URL with nonce for draft pages.
editor_urlstringBricks visual editor URL for the page.

Related Tools

Technical Details

Tool ID
bricks_preview_url
API Endpoint
/bricks-mcp/v1/pages/{page_id}/preview-url
HTTP Method
GET
Namespace
pages-elements
Source File
pages/utilities.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release
20250101