Title: shortcode not parsed inside input field value
Last modified: August 30, 2016

---

# shortcode not parsed inside input field value

 *  Resolved [givemeahand](https://wordpress.org/support/users/givemeahand/)
 * (@givemeahand)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/)
 * <input type=”text” name=”email” id=”email” value=”[php snippet=10 param="field
   ="email"]” class=”validate[required] form-control”>
 * This used to be working for a while and suddenly I do not remember after update
   of plugin or not it stopped working and started to show the shortcode on the 
   output (website).
 * Please advice how to fix that
 * [https://wordpress.org/plugins/php-code-for-posts/](https://wordpress.org/plugins/php-code-for-posts/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [ghimar](https://wordpress.org/support/users/ghimar/)
 * (@ghimar)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6377949)
 * I’ve the same problem after update to WordPress 4.2.3.
 * Have you any suggestion to fix it?
 * thanks
 *  [hackerpreneur](https://wordpress.org/support/users/hackerpreneur/)
 * (@hackerpreneur)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6378001)
 * I’m glad to see that I’m not the only person with this issue, which suggests 
   that the problem is related to the plugin itself.
 * Question is, Is there a fix and is anybody working to resolve the problem.
 * I chose this plugin because it was the one that was most recently updated – just
   hope it’s actively maintained.
 *  [ghimar](https://wordpress.org/support/users/ghimar/)
 * (@ghimar)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6378002)
 * Hello, at the end I have worked around the problem.
    I’ve modified my short code
   and I print all the input type form and not only the value. Clearly is not a 
   solution but it work.
 * see you
 *  [hackerpreneur](https://wordpress.org/support/users/hackerpreneur/)
 * (@hackerpreneur)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6378004)
 * Great idea ghimar. Thanks – hopefully that’ll work for my use-case 🙂
 *  [readych](https://wordpress.org/support/users/readych/)
 * (@readych)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6378056)
 * This problem still exists, with the latest plugin version (2.0.9) and wordpress
   version (4.4.2).
    It seems like, every php snippet inside a html attribute will
   be ignored.
 * For example:
    <div src=”[php snippet=1]“></div>
 *  [tenkinetic](https://wordpress.org/support/users/tenkinetic/)
 * (@tenkinetic)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6378057)
 * I also am experiencing this issue in 4.4.2.
    Eventually a shortcode will render
   all my HTML but I’m using one to inject a value into an input field while ‘proof
   of concepting’ something.
 * Anyway, what I’ve done by way of a quick fix is to change this:
 *     ```
       <input type="text" name="whatever" value="[render_object_value property="name"]" />
       ```
   
 * To this:
 *     ```
       <input type="text" name="whatever" value="" />
       <script>jQuery('input[name="whatever"]').val('[render_object_value property="name"]');</script>
       ```
   
 * jQuery is of course added in my header. This is hardly a job for jQuery though,
   it just makes for slightly less code. If your jQuery is added in your footer 
   and you don’t want the whole ‘run on document load’ rigmarole (which I wouldn’t
   doing this – more code & more delay), I’d go with:
 *     ```
       <input type="text" name="whatever" value="" />
       <script>document.querySelector('input[name="whatever"]').setAttribute('value', '[render_object_value property="name"]');</script>
       ```
   
 * Caveat: I have not checked the validity of the POJS version there but you get
   the idea.
 *  Plugin Author [Jamie Fraser](https://wordpress.org/support/users/thejfraser/)
 * (@thejfraser)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6378058)
 * Hi givemeahand,
 * The issue lies in the way WordPress parses shortcodes.
 * It can detect when your snippet is being used inside an attribute and escapes
   it (probably to prevent user’s running arbitrary shortcodes via poorly coded 
   forms.
 * As such you should use your snippet to output the full value parameter (value
   =”xyz”), or the entire input itself.
 * I hope this helps

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘shortcode not parsed inside input field value’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/php-code-for-posts_0d1022.svg)
 * [PHP Code for posts](https://wordpress.org/plugins/php-code-for-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-for-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-for-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-for-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-for-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-for-posts/reviews/)

## Tags

 * [php code](https://wordpress.org/support/topic-tag/php-code/)

 * 7 replies
 * 6 participants
 * Last reply from: [Jamie Fraser](https://wordpress.org/support/users/thejfraser/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/shortcode-not-parsed-inside-input-field-value/#post-6378058)
 * Status: resolved