WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 have a form that will be re-used in different posts.

I also have php code that will be reused to populate the form with the value in the URL.

I tried to use php shortcode and wp php exec, but it doesn't appear to work:

   value = "[exec]echo htmlentities($_GET['source'])[/exec]"

I basically want a simple, reusable way to grab parameters and have it as the value in a hidden field on a form.

share|improve this question

eval() with insufficiently sanitized input is evil. :-)

share|improve this answer
In case the hint wasn't obvious to you: you should be using esc_attr() or esc_html() rather than htmlentities(). – Denis de Bernardy Nov 11 '10 at 18:33

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.