• Resolved AshGloverZA

    (@onepartscissors)


    Hi all

    The latest version of WordPress is behaving oddly – when i try and add a ‘ or a ” character to the text widget, it adds a \.
    If i click save 3 times, it will add an extra \ to every \ that’s there so it looks like this:

    Text:
    "
    *click save*
    Text Returned:
    \"
    *click save*
    Text Returned:
    \\\"
    *click save*
    Text Returned:
    \\\\\\\"
    *click save*
    Text Returned:
    \\\\\\\\\\\\\\\"

    and so on. It seems to be stuck in some sort of loop that just keeps adding \’s to any character it doesn’t like.

    The odd thing is, i added a plugin called PHP Code, and it behaves the same – thereby breaking any php you might put in there. I also tried installing HTML RAW, but that didn’t work.

    Anyone else getting this? please help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi onepartscissors. I was not able to replicate the problem. Have you tried to disable all of your plugins and then test again to see if a particular plugin is causing the problem?

    Be sure to start from scratch, as in add “test’s” to a text widget and then test again.

    I would avoid using single quote or special characters in a text widget unless wrapped in an element that supports it.

    Hi onepartscissors, were you ever able to figure out what was causing the excessive slashes?

    Thread Starter AshGloverZA

    (@onepartscissors)

    Hi Brad – i wasn’t able to find the problem. I’ve removed all the extra plugins, it’s mystery. i’m going to re-upload the wordpress core, maybe something was corrupted in the upload.

    @swansonphotos – that’s the problem – even if i try and do completely legitimate html it will do this:

    <a href="https://google.com">google.com</a>

    becomes:

    <a href=\"https://google.com\">google.com</a>

    and if i click again it becomes:

    <a href=\\\"https://google.com\\\">google.com</a>

    and when i view the front end – that link tries to go to:

    https://%22http//google.com///%22

    unless i find an answer soon i’m going to have to give up and hard code the theme to make these blocks, but that will be an awful awful development, because it severely limits the client’s editing abilities in the sidebar!

    @brad – can I give you access to the site so you can look and see if i’ve missed something obvious? We can do that via email?

    Hi onepartscissors,

    Technically, what I believe is happening is that (99% sure):

    PHP’s addslashes is adding those slashes to the database itself.

    When they’re printed to the screen, they should be printed using stripslashes.

    Because stripslashes is not remove those slashes, it’s adding additional slashes (over and over again).

    ———————————

    The PHP directive magic_quotes_gpc is on by default, and it essentially runs addslashes() on all GET, POST, and COOKIE data.

    My php setup has magic_quotes_gpc set to Off. What I would recommend is that you use a phpinfo file to determine if you’re setup has magic_quotes_gpc set to On or Off. If it is set to On, I suggest setting it to off and then testing again.

    Thread Starter AshGloverZA

    (@onepartscissors)

    Brad Markle, you have saved the day! Genius, sir!

    The hosting company just moved the site to php 5.3.3, and in doing so, reset all those settings, and magic quotes was on (and register_globals!) so i put that all off like it’s meant to, and it’s working perfectly!

    Thank you so so much for your input!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Text Widget adding \ characters’ is closed to new replies.