Categories
How To

Mailbag: Delete A New Page In Multisite

Force deleting a page for new Multisites.

From Brige:

If u can, could u tell me how I can get rid of a new page that created in a subfolder from multisite ? out of my admin reach now. What would be the fastest way ? Should I restore completely to get rid of all WP remnants in order not to fall into this multisite hooking error : “page not found”?

To be honest, I’m guessing here.

I’m going to assume that Brige means he wants to auto-delete the ‘Sample Page’ page that WordPress generates when you make a new site.

WordPress creates a default post (id #1 – Hello World) and a page (id #2 – Sample Page) when a new WP site is created, be it Multisite or not.

Probably the simplest way would be to hook into wpmu_new_blog() which runs for all new blogs and run this:

wp_delete_post(2, true);

That force deletes the post with the ID 2. And since that’s always the sample page, that should work.

2 replies on “Mailbag: Delete A New Page In Multisite”

Comments are closed.