Should I use custom post types or a custom database tables for plugin development?

Posted by Prem Tiwari | Updated on

You should be skeptical of anyone who says that there is a single “right” way. The right way depends on the situation. Using the CPT infrastructure has a number of notable benefits:

  • You get the Dashboard UI for free
  • You automatically take advantage of WP’s caching, including any persistent cache plugins that the installation may be using
  • You automatically get goodies like post revisions
  • You get access to the¬†WP_Query¬†class, which means that, in theory, you don’t have to write any (or at least not much) likely-to-be-buggy-and-vulnerable-and-inefficient SQL
  • If you’re planning on distributing the plugin or opening it up for open-source development, you may find that developers are more comfortable using custom post types and the associated API functions than your own custom stuff

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers