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.
Comments
2 responses to “Mailbag: Delete A New Page In Multisite”
I’ve been wondering how do to this for ages. I had to call switch_to_blog($blog_id) before calling wp_delete_post().
I network enabled this plugin code:
Full code:
Here is the code that was deleted when I submitted it in the previous content:
http://pastebin.com/7YTs2qqC