Best way to discriminate a "About the category" post?

I auto-create a category along with some object in my application.

Thus, when my user want to delete its object, I want to also delete the category. But before deleting a category, I must delete all the topics in it, and we can’t delete the About the category topic.

Even if deleting the category is possible at this point (with only this topic in it), I’d like a way to not try to delete the About post, and directly try to delete the category instead.

Does this topic has some kind of flag? Should I rely on the fact that it is created by the system user (because it is — through my API client)?

You should be able to delete a category with the About the category topic still in existence. All other topics need to be deleted. The about topic needs to exist as it serves as the category description.


Hi Justin, thanks for the answer.

I know that the category can be deleted, I’d just like my script to not worry when it tries to delete all topics and stumble upon About this category, or better, that it doesn’t try to delete it. Right now I can’t differentiate wether a failed topic deletion is to be considered as a problem or just normal because it’s the About topic :slight_smile:

You can compare the category topic id on the category model to the topic id and just exclude the matches.

1 Like