I'm fairly new to WP development so please excuse me if my question does not make any sense.

I'm trying to develop a plugin and have it (so far) set up and working. I have already registered some options which all work too and get nicely stored as array in the wp_options table.

Now I have read in the WP Developer Handbook that there are 4 methods of saving data and the preferred method would be through Post Meta.

So far so good, but what would I have to do now? Do I need to set up a custom post type first and then add custom fields to it? Would that count as post meta? Guess not, at least I would not know how WP knows that it should put data in the wp_postmeta table.

Maybe I also should explain what exactely I want to do. My plugin is supposed to be some sort of booking plugin which (for now) should do the following:

  • on the frontend the user should be able to set the arrival date, name & address and some booking item.
  • on the backend the admin should see a list of bookings and should be able to manage some plugin options.

Which pretty much means there is no need for a CPT Area in the admin panel - I want to control that within the plugin view.

Again, I'm sorry if my qeustion is stupid but I'm really confused with the ton of options you are able to set.

Any help appreciated!



According to @kero's comments, I want to reformulate my answer:

According to the WP Developers Guide the wp_options table is not suitable for a lot of data. It's supposed to be fairly static content and settings. This means I cant use the Settings API to populate data from my booking plugin.

Furthermore, the guide says that Custom Post Types cover pretty much everything else you need, so this is the road I wanna go down.

What confuses me now is the way how this CPT works! I don't need most of the options of a standard PT and what I really don't understand is how I can add custom fields (or post meta when we are not talking about the admin section)! All I can find online is people using ACF or some other plugin to add those fields. How can I do that manually and would I need to change the capability_type as well?

I would also be happy wit a nice tutorial but so far I did not find anything where people are registering a CPT and manually add CF's.


  • 1
    I'm not sure if this question is a good fit for this site (we prefer clear question and answer type - "best place to store data" probably gets very opinionated answers). However, let me give you a short insight from my personal experience: While there are plugins that create extra tables, I don't think that is the standard WordPress-way. Custom Post Types are. And that does not mean at all, that you need the same layout in the backend (for comparison: almost all form plugins use CPT but most display them differently in the backend) – kero May 29 '18 at 5:58
  • The thing is: the standard view exists. And you may use it if you see fit. But if you don't want to, you don't need to. You can customize almost everything within WordPress. But for that you need to dig deeper, write more custom code, etc. – kero May 29 '18 at 5:59
  • 1
    Instead of building a custom plugin without a good feel for where and how data is stored, you may want to look into prebuilt options. Plugin recommendations are off-topic but I can say generally that some of the more common form plugins, and the most popular ecommerce plugins, already support "booking" type features and are likely to be an easier, more forward-compatible route. If you do stick with your own plugin, yes, a CPT is definitely what you need and the "bookings" will be stored in wp_posts table; postmeta - custom fields - will be stored in wp_postmeta. – WebElaine May 29 '18 at 20:05
  • 1
    See "Creating custom fields manually" - premium.wpmudev.org/blog/creating-custom-fields-manually for a good overview of postmeta, and smashingmagazine.com/2011/10/… for creating a metabox to enter it. Also note though that Gutenberg will be changing the way metaboxes and postmeta work in the near future, so again, using an out-of-the-box solution would be preferable. – WebElaine May 29 '18 at 20:07
  • Thank you for your answer! I'm pretty much aware of HOW my data should be stored and under normal circumstances I would create a table by myself. This is not recommended by WP and in my opinion the documentation really lacks here to explain what exactly you should do instead. The API in general is done very weird but I guess that is some relict from the past. Thanks for the links I will see what I can get out of it! Concerning Gutenberg - I had a short look - I don't think this is a problem, especially not if you have a good OOP aproach. – Florian Ragossnig May 30 '18 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.