bricks_create_page
Overview
Create a new WordPress page or custom post type entry with the Bricks editor mode enabled. The page is created empty — use bricks_add_section afterward to add content. Returns the post ID, permalink, and Bricks editor URL.
Supports any registered post type (page, post, or custom post types like « portfolio », « team_member »). The page defaults to draft status so you can build content before publishing.
Key Features
When to Use
You are setting up a multi-page website and need blank pages ready for content
You need to create a custom post type entry (e.g., portfolio, team member, service)
You want to create a page with a specific slug for SEO purposes
You need a child page under an existing parent for hierarchical content
When NOT to Use
The page already exists (use bricks_list_pages to check first)
You want to create a page AND add content in one call (create page first, then use bricks_add_section)
You need to create a blog post with ACF/meta data (use bricks_create_post for CPT entries with meta)
Parameters
titlestringREQUIREDslugstringoptionalstatusstringoptionaldraft Values: draft, publish, pending, privateparentnumberoptionalpost_typestringoptionalpageCode Examples
Create a basic page
Create a new About page in draft status, then add a hero section to it.
// Step 1: Create the page
bricks_create_page({
title: "About Us",
slug: "about",
status: "draft"
})
// Returns: { post_id: 42, ... }
// Step 2: Add content to the page
bricks_add_section({
page_id: 42,
section: {
type: "section",
children: [{
type: "container",
settings: { "_width": "1200px" },
children: [
{ type: "heading", settings: { tag: "h1", text: "About Us" }, globalClasses: ["text-display"] }
]
}]
}
}){
"post_id": 42,
"title": "About Us",
"status": "draft",
"post_type": "page",
"link": "https://example.com/?page_id=42",
"edit_url": "https://example.com/wp-admin/post.php?post=42&action=edit",
"bricks_edit_url": "https://example.com/?bricks=run&post_id=42"
}Create a child page
Create a child page under an existing Services page.
bricks_create_page({
title: "Web Design",
slug: "web-design",
status: "draft",
parent: 50
}){
"post_id": 55,
"title": "Web Design",
"status": "draft",
"post_type": "page",
"link": "https://example.com/services/web-design/"
}Common Mistakes
// Starting with page creation
bricks_create_page({ title: "Home" })
bricks_add_section({ ... inline styles ... })// Phase 2 first
bricks_create_color({ name: "Primary", ... })
bricks_create_global_class({ name: "btn-primary", ... })
// Then Phase 4
bricks_create_page({ title: "Home" })bricks_create_page({
title: "Contact",
status: "publish"
})
// Empty page is now live!bricks_create_page({
title: "Contact",
status: "draft"
})
// Add content, validate, then publishTips & Warnings
Always draft first: Create pages with status « draft » and only publish after all content is added and validated. Empty published pages hurt SEO.
Check before creating: Run bricks_list_pages with a title search first to avoid creating duplicate pages.
Workflow order: Phase 1 (site context) → Phase 2 (design system) → Phase 3 (templates) → Phase 4 (bricks_create_page + bricks_add_section for each page).