Deleting All Posts and Comments from a WordPress Blog
Post Info Saturday, July 11th, 2009 5:51 pm by Cody Print Print this page

The best way to understand the tables is to look at the WordPress Databae Design page, so you are aware of the dependencies.  I wanted a nearly clean copy of WordPress, so I executed the following SQL statements:

delete from wp_comments;
delete from wp_links;
delete from wp_posts;
delete from wp_postmeta;
update wp_term_taxonomy set count = 0 where 1 = 1;
delete from wp_term_relationships;

This deletes all comments, links, posts, post metadata, resets the count for the tags/categories/links to 0, and deletes the relationships.  I had to delete more than comments and posts, otherwise the tables would be in an inconsistent state.  For example, it may end up showing more than 1 post under a certain tag when all posts have been removed.   Thus, that explains why I had to set count to 0 for wp_term_taxonomy and remove all the links.

4 Responses to “ Deleting All Posts and Comments from a WordPress Blog ”

  1. ALVIN


    Pillspot.org. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. High quality drugs. Buy pills online

    Buy:Arimidex.Synthroid.Accutane.Petcam (Metacam) Oral Suspension.Valtrex.Prevacid.Prednisolone.Human Growth Hormone.Zyban.Zovirax.100% Pure Okinawan Coral Calcium.Nexium.Lumigan.Actos.Retin-A.Mega Hoodia….

  2. CLIFTON


    Medicamentspot.com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. Low price drugs. Buy pills online

    Buy:Aricept.Lasix.Acomplia.Advair.Nymphomax.Cozaar.Prozac.Zetia.Benicar.Lipothin.Amoxicillin.Female Pink Viagra.SleepWell.Lipitor.Zocor.Ventolin.Female Cialis.Seroquel.Buspar.Wellbutrin SR….

  3. FLOYD


    CheapTabletsOnline.Com. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.Best quality drugs. Online Pharmacy. Buy pills online

    Buy:Seroquel.Benicar.Amoxicillin.Aricept.Female Pink Viagra.Lasix.Wellbutrin SR.Buspar.Cozaar.Female Cialis.Nymphomax.SleepWell.Ventolin.Lipitor.Zetia.Advair.Lipothin.Zocor.Prozac.Acomplia….

  4. TODD


    CheapTabletsOnline.Com. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.Best quality drugs. No prescription pills. Buy pills online

    Buy:Prevacid.Prednisolone.Valtrex.Zovirax.Zyban.Synthroid.Accutane.Actos.Mega Hoodia.Human Growth Hormone.Petcam (Metacam) Oral Suspension.Nexium.100% Pure Okinawan Coral Calcium.Retin-A.Lumigan.Arimidex….

Leave a Reply

Get updates as often as we post! Subscribe to our full feed or comments feed.