bricks_restore_revision
Overview
Restores a Bricks page to a previous revision, replacing the current page content with the element tree from the specified revision. Before restoring, the tool automatically saves the current state as a new revision, ensuring no data is permanently lost even if the wrong revision is restored.
This is the undo mechanism for the MCP workflow. Use bricks_get_page_history first to find the correct revision_id, then call this tool to roll back. The automatic pre-restore snapshot means you can always « undo the undo » by restoring the auto-saved revision.
Key Features
When to Use
To restore a named snapshot created before a major redesign
When a build step goes wrong (broken layout, deleted sections) and you need to recover
To revert to a client-approved version after experimental changes
The revision_id must be valid (use bricks_get_page_history to find valid IDs)
WordPress revisions must be enabled
When NOT to Use
To compare two revisions side by side — there is no diff tool, use bricks_get_page_history to review summaries
If you just want to create a save point — use bricks_snapshot instead
Parameters
page_idnumberREQUIREDrevision_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
Restore to a named snapshot
Find a named snapshot in the page history and restore to it, with the safety of an automatic backup.
// Step 1: Find the snapshot
const history = bricks_get_page_history({ page_id: 42 });
// Look for: { revision_id: 148, summary: "Snapshot: Before hero redesign", ... }
// Step 2: Restore
bricks_restore_revision({ page_id: 42, revision_id: 148 })
// Returns: {
// success: true,
// message: "Page 42 restored to revision 148.",
// backup_revision_id: 160,
// restored_element_count: 8
// }
// If the restore was wrong, undo it:
bricks_restore_revision({ page_id: 42, revision_id: 160 })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
Safety net: The automatic pre-restore backup means you can always reverse a restore operation. The backup revision ID is returned in the response — save it in case you need to undo.
Snapshot workflow: For maximum safety, always create a named snapshot with bricks_snapshot before making major changes, rather than relying solely on auto-revisions. Snapshots are clearly labeled in the history and easy to find.
Post-restore verification: After restoring, use bricks_get_page_content to verify the restored content looks correct before making further changes.