bricks_set_homepage

Phase 4BeginnerComplexity: 2/10
Set a page as the WordPress front page

Overview

Sets a specific WordPress page as the static front page (homepage). This configures WordPress to display the chosen page when visitors access the site root URL instead of showing the default blog posts listing.

Internally this updates the WordPress reading settings: it sets the « Your homepage displays » option to « A static page » and assigns the specified page as the front page. This is typically called once after creating and populating the homepage during the site build workflow.

Key Features

WordPress Reading Settings
Automatically configures WordPress reading settings to use a static front page, setting both show_on_front to "page" and page_on_front to the specified page ID.
Idempotent Operation
Safe to call multiple times — if the page is already set as the homepage, the operation succeeds without side effects.

When to Use

After creating and populating the homepage content in Phase 4
When switching the site from a blog-style front page to a static page
After cloning or redesigning the homepage and needing to reassign the front page
Prerequisites
The target page must already exist and be published or in draft
Page ID must be known (use bricks_list_pages to find it)

When NOT to Use

If the site should display blog posts on the homepage (default WordPress behavior)
If you only need to edit the existing homepage content — use bricks_add_section or bricks_update_element instead

Parameters

1 Total Parameters1 Required
page_idnumberREQUIRED
The WordPress page ID to set as the static front page (homepage).

Code 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

Set homepage after building it

After creating the homepage content in Phase 4, assign it as the site front page so visitors see it at the root URL.

JSON
// Step 1: Create the page
const page = await bricks_create_page({ title: 'Home', status: 'publish' });

// Step 2: Add hero section, features, etc.
await bricks_add_section({ page_id: page.id, elements: { ... } });

// Step 3: Set as homepage
bricks_set_homepage({ page_id: page.id })

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
Always populate the page with content first. Setting an empty or incomplete page as the homepage will show a blank or broken front page to visitors.

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
This tool only works with WordPress pages (post_type: page), not blog posts or custom post types. Use bricks_list_pages to verify the correct ID.

Tips & Warnings

Tips & Warnings

WordPress reading settings: This tool modifies the core WordPress options show_on_front and page_on_front. Any previous homepage assignment is overwritten.

Blog page: If you also need a blog page, you can set it separately via WordPress admin or by updating the page_for_posts option.

Return Values

FieldTypeDescription
successbooleanWhether the homepage was successfully set.
messagestringConfirmation message including the page ID and title now set as the front page.
pageobjectObject with the page id, title, and link of the newly assigned homepage.

Related Tools

Technical Details

Tool ID
bricks_set_homepage
API Endpoint
/bricks-mcp/v1/pages/{page_id}/set-homepage
HTTP Method
POST
Namespace
pages-elements
Source File
pages/settings.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with WordPress reading settings integration.
20250101