Link to home
Create AccountLog in
Avatar of paquicuba
paquicubaFlag for United States of America

asked on

Wordpress theme escaping double quotes

I'm working with a WordPress theme named Realty. Everything is looking good except that I cannot reference images using the img tag. Below is what I get:

<img src=\"\" />

As you can see the double quotes are getting escaped. I was reading about this issue and a fix is to turn the following parameters off:

magic_quotes_gpc      Off      Off
magic_quotes_runtime      Off      Off
magic_quotes_sybase      Off      Off

..And they are off in the phpinfo.php page.

Please let me know what I need to do to be able to use the img tag and the image to show in a browser.

Avatar of paquicuba
Flag of United States of America image


I don't know if this make a difference, but the hosting is with
Avatar of Dave Baldwin
No, it does not make a difference.  There is not enough there to tell for sure but something in PHP may be running that thru 'addslashes' when it isn't needed.  Or is that coming from the database?  You may need to add a 'stripslashes' function somewhere to get rid of the extra backslashes.
in php when you use double back slash it skips processing that part of php so try

<img src="" />

<img src=\"\" />

hope this helps.
I have placed the stripslashes function in the functions.php of the theme and nothing...
OK. I removed the double-quotes completely and the images are now showing. My questions is: Will that affect the overall code?

Now it looks like this:

<img src= />
problem with your img tag:

<img src= />

should be
<img src="" />

might affect your code due quotes missing.


---->  echo '<img src= />';

could cause php to stop working or image will not be found because ...images/realtor.jpg/

is looking for a file or location which goes beyond the image file itself.

so use the fix i provided should fix the problem if there are any.
problem with your img tag:

<img src= />

should be
<img src="" />

I know it should be:

<img src="" />

But my problem is that when I type the URL enclosed in double-quotes, Wordpress (NOT me) is escaping the double-quotes and creating the following:

<img src=\"\" />

So, the above doesn't work either and I cannot find a solution to get rid of Wordpress behaviour.

Avatar of Shaun_King_23
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks a lot for trying, but nothing seems to work. I'll install a new theme...