• I don’t know what is causing this, but every single post on my site now has backslashes riddled in each link in all the post’s code.

    For instance, what should be a normal video embed code:
    <iframe width="695" height="391" src="https://www.youtube.com/embed/KKXewWDh1og" frameborder="0" allowfullscreen></iframe>

    Now suddenly appears like this, effectively breaking everything:
    <iframe width=\"695\" height=\"391\" src=\"https://www.youtube.com/embed/KKXewWDh1og\" frameborder=\"0\" allowfullscreen></iframe>

    I have done research and tried stripping the slashes as per a few recommendations, as well as modifying wp-settings.php… both to no avail. I don’t understand why this happened now, seemingly out of the blue. I don’t have access to php.ini to know if it is because of magic quotes, and I can’t fully tell if that issue only applies to apostrophes or not. Regardless, I have never seen these slashes appear in the posts prior to this.

    I can go through and remove the backslashes by hand, and it fixes the post, but I would rather not do that to 500+ posts. There has to be a workaround/fix because this has never been an issue until now. You can see an example of a post that I fixed (2nd down) manually, versus the rest on the page: https://www.andysapp.com/

    Any help would be greatly appreciated! As it stands now, my site looks massively broken. Every post is affected.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter andysapp

    (@andysapp)

    Everything I am reading about this magic quotes issue is all from between 2-4 years ago… would that even still be an issue now? I am trying every fix I read of, but none of them are working… and I am thinking it is because all these fixes are so old.

    Thread Starter andysapp

    (@andysapp)

    I found some newer posts with the same issue, so maybe not.

    Also, I physically see these backslashes in the posts when I open them to edit them. If I’m understanding the magic quotes issue correctly, the backslashes occur when the page is parsed by the server?

    Sounds like your host has enabled magic quotes in the php.ini. PHP 6+ doesn’t use them IIRC.

    See if they’re enabled (99% sure they are) make an empty file, put this in it:

    if(get_magic_quotes_gpc())
    	echo "Magic quotes are enabled";
    else
    	echo "Magic quotes are disabled";

    and call it test.php and stick in the docroot of your server.
    If they are enabled (99% sure they are) send a polite email to your host and ask them to disable it.

    Thread Starter andysapp

    (@andysapp)

    Nailed it! They are definitely enabled. I will contact them right now about it. Hopefully that will fix it!

    Thanks!!!

    Thread Starter andysapp

    (@andysapp)

    Ok, so my host turned off magic quotes, but the issue is still very present.

    Is there a reason that those backslashes would have somehow been added to the database itself? Because I see them if I go to edit the post.

    And if that is the case, is there an easy way to purge those from the database itself rather than editing 500+ posts through the WP interface?

    Thread Starter andysapp

    (@andysapp)

    It doesn’t make sense to me why these slashes are now in all the posts… and why this is all happening now. This site has been running fine since like… 2005.

    Thread Starter andysapp

    (@andysapp)

    Regardless, if I need to bite the bullet and start manually fixing all these posts, then I’ll do that. It seems like there is an easier way to fix them though.

    Thread Starter andysapp

    (@andysapp)

    I couldn’t stand it anymore. I manually fixed the posts on the main page, but am still looking for help on how to fix the rest of the site’s posts.

    If for some reason you need to see the posts that are affected, they are from page 2 and beyond.

    Thread Starter andysapp

    (@andysapp)

    I hate to bump the thread, but I still cannot find any solution to this, and need help figuring it out.

    Thread Starter andysapp

    (@andysapp)

    I feel like I am a pretty savvy guy, and I am at a loss. My site has been screwed for over a week now with little help, and even less luck.

    I looked in the wp_posts > post_content tables in the database with phpMyAdmin, and can in fact see that all these backslashes are in the database for every entry.

    Is there a way to pull all these slashes out of the database without manually editing over 500 posts?

    Thread Starter andysapp

    (@andysapp)

    I feel like I am essentially talking to myself here. This is frustrating.

    My hosting company walked me through the process of exporting the database, doing a mass search/replace, and importing it back into a fresh database… then re-linking the wp-config to the new database.

    Doing a search/replace for those backslashes fixed all the broken images/video embeds, but it created a new problem… where line breaks get converted to /r/n by WordPress. So now everywhere there should be a break for paragraphs, it just says rn or rnrn.

    Unfortunately, I can’t use the same search/replace to just add the backslashes to every instance of rn… because when words like “burning” are used… it changes them too, so they read as “bur

    ning”.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Magic Backslashes Appearing from Nowhere.’ is closed to new replies.