WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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'] 


share|improve this answer
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 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.