Wordpress > How to remove the default pages (about, hello world) via script
[Update: I've found the API reference. The method used is below]
<?php wp_delete_post( $postid, $force_delete = false ) ?>
I've got a wordpress plugin that creates my default pages for me (about us, contact us, privacy policy, etc) when I first install a new wordpress site. It works really well and gives me a quick boost to rapidly build the site.
However, one problem I have is that I still have to manually remove the default wordpress page (about) and post ("hello world") as well as enable Akismet.
I'd like to add these functions to my plugin.
My question:
Assuming I'm deleting by ID, can I reasonably depend on the default ids for these pages to remain constant from site to site and host to host? (ie, has anyone found that their are differences in various web host wordpress installers that would create different IDs for these pages)
Otherwise, I suppose开发者_高级运维 I could delete based on the page title matching "About" and "Hello World". It is a brand new site, after all.
I guess / assume IDs are the same on new installations by default. (but might be safer to delete based on title).
You could auto-enable plugins, but sometimes you want to use a different wordpress.com account (API key) to activate your Akismet. Recent Akismet keys can also be obtained by email - so you might perhaps want to change them from time to time or for different projects.
精彩评论