tags:

views:

30

answers:

1

[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.

A: 

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.

Tom
Thanks for your feedback Tom. I've located the API docs here: http://codex.wordpress.org/Function_Reference/wp_delete_postThe command is <?php wp_delete_post( $postid, $force_delete = false ) ?>
Scott B