<p>I figured it out somewhat by using the <a href="https://github.com/boboldehampsink/import" rel="nofollow">Import plugin, by Bob Olde Hampsink</a>, exporting all my slugs to a csv, then using the delete functionality of the plugin to remove all entries with a slug found in the csv. Worked perfectly!</p>

CC BY-SA 3.0
2014-07-18T13:13:21.270Z
2014-07-18T13:13:21.270Z
Seán O'Grady
<p>On a related task, if you want to just empty out a section or type, delete queries in the <code>entries</code> table matching on <code>sectionId</code> or <code>typeId</code> fields. This  also cascades. Then you can keep your other sections, especially singles, which otherwise force you to delete and recreate the section to restore the single type entry.</p>

<p>EDIT: After doing this and batch importing data, I noticed the slugs were generated as duplicates (added integer on the end). Sure enough, <code>elements_i18n</code> wasn't cleared out like <code>entries</code> and <code>elements</code> tables. So you'll have to change the query to delete rows from both tables or use the first method above and somehow filter for the sectionId you want.</p>

CC BY-SA 3.0
2018-04-12T21:28:26.283Z
2018-04-13T04:40:50.047Z
2018-04-13T04:40:50.047Z
borducks
<p>As far as I know, you can only do that by deleting and recreating a section.</p>

CC BY-SA 3.0
2014-07-18T12:58:45.067Z
2014-07-18T12:58:45.067Z
Bryan Redeagle
<p>You could also delete all rows in your <code>craft_elements</code> table, which have <code>type</code> set to <code>Entry</code> (or whatever <a href="http://buildwithcraft.com/docs/plugins/working-with-elements">ElementType</a> you want to delete).</p>

CC BY-SA 3.0
2014-07-18T17:59:21.850Z
This is a great answer. Deleting an element from the `craft_elements` table will properly cascade and automatically delete any related rows in other tables.
Lindsey D
CC BY-SA 3.0
2016-06-26T23:23:41.810Z
How does this cascade? Is this a MySQL feature I don't know about? Thanks.
JamesNZ
CC BY-SA 3.0
2016-06-26T23:32:54.480Z
Evidently it must be. I deleted all "Entry" rows from craft_elements and sure enough it emptied out all other relevant tables. Thanks for the suggestion. I'd love to know how that works if anyone knows?
JamesNZ
CC BY-SA 3.0
2014-07-18T14:26:11.893Z
2014-07-18T14:26:11.893Z
Victor
<p>Starting on a second site which is an almost like for like copy of the first, except it has different content. I cant use locales to manage it because there may be the possibility of multiple languages on the second site.</p>

<p>I have dozens of field &amp; entry types I want to transfer over to the second site. Is there an automated way of deleting all the content?</p>

<content><deletion>
Is there a way to delete all entries?
# Is there a way to delete all entries?

(Asked by: username_0 on 2014-07-18)

Starting on a second site which is an almost like for like copy of the first, except it has different content. I cant use locales to manage it because there may be the possibility of multiple languages on the second site.

I have dozens of field & entry types I want to transfer over to the second site. Is there an automated way of deleting all the content?

**Tags:** content, deletion

---

## 4 answers

### Answer by username_3 on 2014-07-18. Score: 11 | Accepted answer

You could also delete all rows in your `craft_elements` table, which have `type` set to `Entry` (or whatever [ElementType](http://buildwithcraft.com/docs/plugins/working-with-elements) you want to delete).

> **Comments:**
> **username_4**: This is a great answer. Deleting an element from the `craft_elements` table will properly cascade and automatically delete any related rows in other tables.  
> **username_5**: How does this cascade? Is this a MySQL feature I don't know about? Thanks.  
> **username_5**: Evidently it must be. I deleted all "Entry" rows from craft_elements and sure enough it emptied out all other relevant tables. Thanks for the suggestion. I'd love to know how that works if anyone knows?  

---

### Answer by username_0 on 2014-07-18. Score: 3

I figured it out somewhat by using the [Import plugin, by Bob Olde Hampsink](https://github.com/boboldehampsink/import), exporting all my slugs to a csv, then using the delete functionality of the plugin to remove all entries with a slug found in the csv. Worked perfectly!


---

### Answer by username_1 on 2018-04-12. Score: 1

On a related task, if you want to just empty out a section or type, delete queries in the `entries` table matching on `sectionId` or `typeId` fields. This also cascades. Then you can keep your other sections, especially singles, which otherwise force you to delete and recreate the section to restore the single type entry.

EDIT: After doing this and batch importing data, I noticed the slugs were generated as duplicates (added integer on the end). Sure enough, `elements_i18n` wasn't cleared out like `entries` and `elements` tables. So you'll have to change the query to delete rows from both tables or use the first method above and somehow filter for the sectionId you want.


---

### Answer by username_2 on 2014-07-18. Score: 0

As far as I know, you can only do that by deleting and recreating a section.


---

