shortcodes not working in input element after update to 4.2.3
-
Hi,
after updating on the dev environment my formulars, that use short codes for easy value handling are broken.
I have looked a bit into the wp code and found out, what causes this, but not, if its intended or not.
Steps to reproduce:
1. Create a short code like this:
function scTest($atts) { return 'TEST: ' . $atts['var']; } add_shortcode('TEST_SHORT_CODE', 'scTest');
2. Create a page using the short code like this:
Works: "[TEST_SHORT_CODE var='user.test']" <p class="[TEST_SHORT_CODE var='user.test']">Works</p> <div class="form-group"> <label for="test">Does not work</label> <input id="test" class="form-control" name="user[test]" type="text" value="[TEST_SHORT_CODE var='user.test']" /> </div>
You will see, that the short code works stand alone, in the p.class attribute, but not in the input.value attribute.
This is due to the changes in shortcodes.php and kses.php – particulary caused by kses.php:856.
The reason is that $allowedposttags does not contain “input”. Therefor using short codes in input fields won’t work.
How can I solve this problem (ofcourse without chaning wp-code)? I need short tags working there for easy use of formulas within my wp-page or I need to know, how it is intended in WP, to get the values back in the formulars, if short codes are not the way to go.
Last but not least it would be nice to know, if this is not a bug, why it is not allowed to use short codes in input fields.
Best regards
- The topic ‘shortcodes not working in input element after update to 4.2.3’ is closed to new replies.