bricks_delete_page
Overview
Delete a WordPress page. By default the page is moved to the trash (recoverable), but you can permanently delete it by setting force to true. Always use bricks_list_pages first to verify the correct page ID before deleting.
After deletion, any links pointing to this page across the site become broken. Run bricks_scan_links with the « broken » filter to find and fix stale references in menus, headers, footers, and other pages.
Key Features
When to Use
You are cleaning up draft or test pages that are no longer needed
A page has been replaced and the old version should be removed
You need to permanently delete a page from the trash
When NOT to Use
You are unsure which page to delete (use bricks_list_pages to verify first)
The page is the homepage (use bricks_set_homepage to reassign first)
Parameters
page_idnumberREQUIREDforcebooleanoptionalfalse Values: true, falseCode Examples
Move a page to trash
Soft-delete a page so it can be recovered later if needed.
bricks_delete_page({
page_id: 55
}){
"success": true,
"message": "Page 55 moved to trash.",
"page": {
"id": 55,
"title": "Old About Page",
"status": "trash"
}
}Permanently delete a page
Force-delete a test page that is no longer needed.
// Step 1: Verify the page
bricks_list_pages({ search: "Test Page" })
// Step 2: Permanently delete
bricks_delete_page({
page_id: 99,
force: true
})
// Step 3: Fix any broken links
bricks_scan_links({ filter: "broken" }){
"success": true,
"message": "Page 99 permanently deleted.",
"page": { "id": 99, "title": "Test Page", "status": "deleted" }
}Common Mistakes
bricks_delete_page({ page_id: 55 })
// Broken links remain in menus and footer!bricks_delete_page({ page_id: 55 })
bricks_scan_links({ filter: "broken" })
bricks_update_links({ updates: [...] })bricks_delete_page({ page_id: 55, force: true })
// Cannot be undone!bricks_delete_page({ page_id: 55 })
// Recoverable from trashTips & Warnings
Always verify first: Use bricks_list_pages to confirm the correct page ID before deleting. Deleting the wrong page can cause significant data loss.
Fix broken links: After deleting a page, run bricks_scan_links({ filter: « broken » }) to find and repair any references to the deleted page across the site (Phase 4.7).
Homepage safety: If the page is the current homepage, reassign the homepage to another page with bricks_set_homepage before deleting.