I am trying to create a Custom Premium WordPress theme for a Travel Agency. I am thinking of finishing the theme and submitting it for review.

I want this theme to be really useful so I ended up creating some Custom Post Types (CPT) like :

  • Organized Trip : with custom fields(CF) like : Hotel name, Trip Duration,Type of reservation,... .

I honestly agree with those who say for a better code these CPT & CF belong into a Plugin something like **Organized Trip Plugin **.

So should I :

  1. Make this a separate plugin and pack it into the WordPress theme in a bundle way with TGM Plugin Activation.


  1. write down these Custom post types into the WordPress theme files and include them in the functions.php - Theme Setup.

Which one do you think is the Best Way to do this?


You will be rejected from the WordPress.org theme direcotry if you include these post types in the theme. The guidelines, which are available here, state:

Non-design related functionality is not allowed. (See: Plugin territory examples)

And one of the examples is:

Custom Post Types and Shortcodes

Regarding TGM, the guidelines have this to say:

  • Themes cannot include plugins
  • Themes cannot require plugins to work
  • Themes may recommend plugins from WordPress.org
  • Themes may only use TGM Plugin Activation or similar libraries to recommend and install plugins that are hosted on WordPress.org (by using 'required' => false for each plugin)

So you will not be rejected if you use TGM, as long as your plugin is recommended, and not required.

This is best practice regardless of the directory rules though. If post types are included in the theme, then if the user switches themes they will lose access to their content, because the post types are no longer registered. This should not happen from switching themes. The content may not display correctly in the new theme, but the user will at least still have access to it.

  • Hi @Jacob Peattie and thank you for your answer , so I can only recommend plugins from WordPress.org for the second option I need to submit the plugin independently and wait for it to get accepted in Wordpress.org so that I can recommend it on the theme? – Aness Oct 11 '19 at 0:13
  • Also for the first option: you mentionned "Non-design related functionality is not allowed". If I add a design with specific files ( single-organizedtrip.php and archive pages to display the CPT beautifully ) could it help? – Aness Oct 11 '19 at 0:16
  • You can have templates for the post type, but you can't register the post types themselves in the theme. They need to come from a plugin. Your theme can have templates and designs for displaying custom content and functionality, but it can't be responsible for adding that functionality. A store theme can have custom templates and design for products, but the products functionality needs to come from a plugin, for example. – Jacob Peattie Oct 11 '19 at 0:20
  • Hi @ Jacob Peattie After reading some Forums and all I finally got it, so basically I can recommend some already existant plugins(from wordpress.org) in my theme to help create my CPT and add correct additionnal templates in my theme files and make it work with TGM and a save/backup (json) strategy. The only down point as u stated is that it will not display correctly if user change theme but it is not an issue in this case. Thanks again and have a nice day I marked your response. – Aness Oct 11 '19 at 1:07

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.