Why are HTML formatting tags being added to my shortcode output?
-
I just upgraded a client’s site to WP 3.4 on the test server and have noticed an issue.
I have various shortcodes in my functions.php which pull in separate files containing forms. I do this for two reasons: (1) so the form code doesn’t get mangled in the editor, and (2) so the forms can be easily reused on various pages.
This has worked well until the 3.4 upgrade, and is still working fine on the live site, running 3.3.
For some reason, WP is now inserting various HTML tags such as
<p>
and<br />
in between the input tags, which is messing up the formatting.An example of the shortcode, as well the form code, and the browser source, are here: http://pastebin.com/pQajDntX
In the browser source version, note all the extraneous
<br />
and<p>
tags.Is there some other ways I should write the shortcode function to avoid this problem? Or is there something else going on?
Thanks for any suggestions.
EDIT: Someone on Twitter suggested the following workaround, which actually works:
[raw][my_shortcode][/raw]
The only problem is this means I’d have to go through every single post and page on the site to make the changes – is there something I can do in the function or elsewhere in the theme to have the raw effect applied automatically?
- The topic ‘Why are HTML formatting tags being added to my shortcode output?’ is closed to new replies.