6

I duplicated a site. What is the easiest way to delete all assets and text data but keep fields and sections in place?

8

You can delete all of your existing entries and assets by executing this SQL query:

DELETE FROM craft_elements
WHERE type IN ('Entry', 'Category', 'Tag', 'Asset')

All associated content, relationships, etc., will automatically be deleted.

If you have a bunch of users you want to delete, you should at least spare your own admin account, so figure out your user ID and do this:

DELETE FROM craft_elements
WHERE type IN ('Entry', 'Category', 'Tag', 'Asset', 'User')
AND id != 1

(The admin account created during installation will have the ID of 1, assuming you haven’t deleted the account.)

You should also delete existing asset sources, assuming those are going to need to change and will have their own sets of files. You can either do that from the Control Panel, or execute this SQL query:

DELETE FROM craft_assetsources

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.