bricks_set_homepage
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
When to Use
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
Page ID must be known (use bricks_list_pages to find it)
When NOT to Use
If you only need to edit the existing homepage content — use bricks_add_section or bricks_update_element instead
Parameters
page_idnumberREQUIREDCode 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.
// 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
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
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.