I am creating a plugin that users can create forms with. Then the user will be able to input a shortcode to display this form. The shortcode will be the form name, which is stored as a meta_value in the wp_postmeta table. When the user uses a shortcode, how do I refer back to the form name & display the form?

When the user creates a form, should I automatically create a shortcode in the same script? How would you approach it?


You could use it like

[form id="abc123"]

where the value of id is the meta_value. You could generate the shortcode so the user can easily copy/paste it into the editor. Or even have a custom made button in the editor to insert it.

You can check how it's done in other plugins like Contact Form 7:

[contact-form-7 id="50" title="My form"]


and Fast Secure Contact Form:

[si-contact-form form='1'] 


  • Thanks for helping @birgire. I'm new to wordpress & worked this out when I turned my laptop off, so must be improving. Thanks again!
    – mattnewbie
    Mar 12 '13 at 16:46

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.