I made a shortcode for wordpress and the code from functions.php looks like this:
return '<div class="video-shortcode"><iframe width="600" height="365" src="/watch.php?file=' . $atts['file'] . '&img=' . $atts['img'] . '" frameborder="0" scrolling="no" allowfullscreen></iframe></div>';
When i’m using it, the source code from the post should look like this:
<iframe width="600" height="365" src="/watch.php?file=myfile.mp4&img=myimg.jpg" frameborder="0" scrolling="no" allowfullscreen></iframe>
But for some reason, the ampersand before the ‘img’ appears as this:
&
for similar problems to solve you could use html_entity_decode function of php
I was having a similar issue. There is very little to do that won’t be breaking basic WordPress functions. To break basic WP functions see this answer. For the “right” answer see this answer. I’m using the latter successfully.
Basically use
&
not the other html entity, as this is considered correct XML and is parsed in the iFrame tag by browsers.