0

I'm using add_meta_box as per the Codex entry.

My question is about the 'callback' to print the form fields on the admin page.

In the Codex, the form fields are echoed as written out HTML elements, but in some plugins I've looked through, the developers prefer to use 'callback_args' to pass an easy to understand array to pseudo-form elements that is then processed to output the HTML elements with minimal HTML coding. See, for example, this code on GitHub. WooCommerce also has a similar way to build meta boxes for products.

So my question is: does WordPress by default have a similar mechanism or is that a feature that requires a plugin?

1

Short answer: no. WordPress core has the basic meta box functionality (registering a box & passing a callback) - what that callback does, or how it works, is entirely up to you. You can either code your own implementation, or use a 3rd party as you mentioned.

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.