0

I've been tasked with my first WordPress project. It's a project that involves custom plugin development. While looking over the documentation for adding custom post types I found the meta boxes functions.

I'm a bit confused. Does WordPress require it's developers to manually save, sanitize, validate all the meta boxes? Are there no pre-built options for simple data such as text, textarea and similar?

Really my question maybe boils down to are registering custom post types and meta boxes and manually handling the said above the correct path while developing a plugin for registering different events that would, for example, include inputs for dates, street addresses and such.

Thanks.

  • you should try advancedcustomfields.com, they kinda took the leg work out of metabox fields. – David Sword Feb 17 '18 at 20:10
  • You'll have to be a lot more specific about your purposes to get a helpful answer on the boiled-down question. My guess is probably you don't need custom post types, but I can't say for sure, and, David Sword is right that ACF offers some useful tools - but why bother adding it to your learning-burden if all you need is three inputs to get a simple plugin running? As for the middle question, yes, WP has a set of sanitization/validation functions for different types of data, and others for securing processes on the back end. – CK MacLeod Feb 17 '18 at 23:14
0

Does WordPress require it's developers to manually save, sanitize, validate all the meta boxes?

Yes.

Are there no pre-built options for simple data such as text, textarea and similar?

Not in core, no.

There are plugins like Advanced Custom Fields or CMB2, among others, that simplify this process though. A Fields API has been proposed, but has taken a backseat to Gutenberg.

Really my question maybe boils down to are registering custom post types and meta boxes and manually handling the said above the correct path while developing a plugin for registering different events that would, for example, include inputs for dates, street addresses and such.

Probably yes, but you can do just about anything in WordPress if you want, so it's not the only option. You could use custom tables, or integrate with a 3rd party or off-site API or almost anything you can think of. How to choose a specific solution to such a broad problem is well beyond the scope of this forum though.

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.