Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am creating a plugin. That enables users to create forms, & display these with shortcodes on a site. When creating a form (using custom post types), users will be able to add additional form fields with meta boxes.

My question: When a user creates a form (via custom post type), how do I store the field type so the shortcode knows which type to display for the form?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Store each field the user creates as an array in a post meta field, the array would contain the name and a reference to the field type. You could also store additional data within the array, like if it's required and the type of validation to apply.

share|improve this answer
    
Thanks. This is my first plugin, so learning a lot! Would you create a new table to store this array in? Or would you store this in 'meta_value' in the wp_postmeta table? Thanks!! –  mattnewbie Mar 7 '13 at 20:47
    
in the post meta table –  Milo Mar 7 '13 at 21:01
    
thanks for helping me. Now sorted! –  mattnewbie Mar 8 '13 at 23:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.