Title: SQL Script to remove ALL properties from DB
Last modified: May 17, 2022

---

# SQL Script to remove ALL properties from DB

 *  Resolved [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [4 years ago](https://wordpress.org/support/topic/sql-script-to-remove-all-properties-from-db/)
 * We have Estatik Remove Properties Plugin, but way too slow… we have over 10,000
   properties, Estatik plugin will takes hours to complete.
 * Need Faster method.
 * What is SQL Script to remove ALL properties from DB?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Estatik](https://wordpress.org/support/users/estatik/)
 * (@estatik)
 * [4 years ago](https://wordpress.org/support/topic/sql-script-to-remove-all-properties-from-db/#post-15655837)
 * Hello,
    Please try the following script for the DB: DELETE FROM wp_posts WHERE
   post_type=’properties’; DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT 
   id FROM wp_posts); DELETE FROM wp_term_relationships WHERE object_id NOT IN (
   SELECT id FROM wp_posts) IF you use PHP code, try the following request: $allposts
   = get_posts( array(‘post_type’=>’properties’,’numberposts’=>-1) ); foreach ($
   allposts as $eachpost) { wp_delete_post( $eachpost->ID, true ); } Please note
   that the great amount of listings can cause timeout error of the server with 
   these requests. I should note that we do not recommend to delete the listings
   from the DB directly. This kind of deletion will leave some listings data on 
   the server. Please make sure you have full website backup before any changes 
   on it. Thanks.
 *  Thread Starter [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [4 years ago](https://wordpress.org/support/topic/sql-script-to-remove-all-properties-from-db/#post-15721368)
 * GET SQL ERROR
    #1054 – Unknown column ‘’properties’’ in ‘where clause’
 *  Thread Starter [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [4 years ago](https://wordpress.org/support/topic/sql-script-to-remove-all-properties-from-db/#post-15721473)
 * wp_posts does not contain post_type=’properties’

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘SQL Script to remove ALL properties from DB’ is closed to new replies.

 * ![](https://ps.w.org/estatik/assets/icon-256x256.png?rev=2819514)
 * [Estatik Real Estate Plugin](https://wordpress.org/plugins/estatik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/estatik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/estatik/)
 * [Active Topics](https://wordpress.org/support/plugin/estatik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/estatik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/estatik/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/sql-script-to-remove-all-properties-from-db/#post-15721473)
 * Status: resolved