bricks_copy_section
Phase 4IntermediateComplexity: 5/10
Copy a section and children from one page to another
Overview
Copies a section and all its child elements from one Bricks page to another. Creates new element IDs in the target page to avoid conflicts. The source page is not modified. This is ideal for reusing hero sections, CTAs, feature grids, or any section across multiple pages without rebuilding them.
Key Features
Cross-page section copying
Copies a complete section with all nested children from one page to another while generating fresh element IDs.
Flexible positioning
Insert the copied section at the beginning (prepend), end (append), or at a specific index among root sections.
Non-destructive
The source page remains completely untouched — only the target page is modified.
When to Use
When reusing a CTA, hero, or feature section across multiple pages
When building page variants that share some sections but differ in others
When migrating sections from a template or staging page to production pages
When you need a copy of a section to customize independently on another page
When building page variants that share some sections but differ in others
When migrating sections from a template or staging page to production pages
When you need a copy of a section to customize independently on another page
Prerequisites
Both source and target pages must exist
The section_id must be a root element (parent: 0) on the source page
Source page must have Bricks content
The section_id must be a root element (parent: 0) on the source page
Source page must have Bricks content
When NOT to Use
When you want the section to stay synchronized across pages — use a section template with bricks_create_template instead
When copying an entire page — use bricks_clone_page instead
When moving a section within the same page — use bricks_reorder_sections instead
When copying an entire page — use bricks_clone_page instead
When moving a section within the same page — use bricks_reorder_sections instead
Parameters
5 Total Parameters3 Required2 Optional
source_page_idnumberREQUIREDSource page ID containing the section to copy.
section_idstringREQUIREDSection element ID to copy. Must be a root element on the source page.
target_page_idnumberREQUIREDTarget page ID to copy the section into.
positionstringoptionalWhere to insert the section in the target page.
Default:
append Values: append, prependposition_indexnumberoptionalInsert at a specific index among root sections. Overrides the position parameter if provided.
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 1935
Copy a CTA section to another page
JSON
{
"tool": "bricks_copy_section",
"params": {
"source_page_id": 33,
"section_id": "abc123",
"target_page_id": 45,
"position": "append"
}
}Response
{
"section_id": "xyz789",
"element_count": 12,
"id_map": {
"abc123": "xyz789",
"def456": "uvw012",
"ghi789": "rst345"
}
}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 1935
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
The section_id must be a root-level element (parent: 0). Providing a container or content element ID will fail. Use bricks_get_page_summary to identify root section IDs.
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 1935
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
The copied section is independent — changes to the source section will NOT propagate to the copy. For synchronized content, use a section template instead.
Tips & Warnings
Tips & Warnings
ID mapping: The returned id_map lets you reference elements in the copied section by their new IDs. This is useful if you need to immediately update elements in the copied section (e.g., change text or add classes) using bricks_update_element or bricks_bulk_update_elements.
Return Values
Related Tools
Technical Details
Changelog
v1.0
Initial release
20250101