Custom Post Type Definition should not be in the theme – how?

Is there a way to define a custom post type independent from a theme? All sources I found in the web do that in the theme, fuctions.php or via including other theme-specific php-files.
But in my eyes this makes no sense. Where is the separation between content (custom post type) and layout (theme)?

An other problem I see is changing the theme. Data is still in database, I know, but no way to edit or add new items.

Related posts

Leave a Reply

1 comment

  1. Is there a way to define a custom post type independent from a theme?

    Of course, put the Custom Post Type definition in a plugin. Short answer, and kind of obvious, but I am not sure what else to add.