Current Location: Home> Latest Articles> DedeCMS Guide to Deleting Categories and Key Considerations

DedeCMS Guide to Deleting Categories and Key Considerations

M66 2025-10-07

Preparation Before Deleting Categories in DedeCMS

When building a website with DedeCMS, it is often necessary to delete unused categories. Properly deleting a category ensures database consistency and prevents any disruption to site access. This article outlines important considerations for deleting categories and provides practical examples.

Key Tables and Data Consistency

Deleting categories involves several important database tables: dede_arctype, dede_addonarticle, and dede_archives. When removing a category, it is essential to handle these tables consistently to avoid leftover data or site errors.

Backing Up Data

Before performing any deletion, always back up the relevant data. You can use DedeCMS's built-in backup function or directly export the database to prevent unexpected issues.

Finding the Category ID

Before deleting a category, you need to confirm its ID. The category ID can be found in the DedeCMS backend under category management or directly queried from the database.

Deleting Categories

Deleting a category requires sequential operations on the related tables to maintain data consistency.

DELETE FROM dede_arctype WHERE id = 'category_ID_to_delete';

Next, delete the corresponding records from the dede_addonarticle table:

DELETE FROM dede_addonarticle WHERE typeid = 'category_ID_to_delete';

Finally, delete the corresponding records from the dede_archives table:

DELETE FROM dede_archives WHERE typeid = 'category_ID_to_delete';

Updating Cache

After deleting a category, update the DedeCMS cache to ensure the website functions properly. This can be done in the backend by selecting the 'Update Cache' option.

Conclusion

When deleting a category in DedeCMS, follow these steps: back up data, locate the category ID, delete related database records, and update cache. Exercise caution to avoid accidental deletion, which may result in irrecoverable data loss. Following these steps ensures safe and efficient category management while keeping the website running smoothly.