WordPress.org

Support

Support » How-To and Troubleshooting » get_option and stripslashes

get_option and stripslashes

  • GrandSlambert
    Member

    @grandslambert

    I am a bit confused as to why, as of WP 2.6.5, the get_option() function now strips slashes on all options except for a few hard coded wordpress options. This causes a serious problem when options need to have slashes in them, for example in a preBind username for WPDirAuth. There does not seem to be a way to prevent the get_option() function from running the returned value through stripslashes().

    We are using wpDirAuth in a corporate environment and the preBind username has a \ in it. The plugin wasn’t working with 2.6.5 or 2.7 because get_option() removed the required backslash. For now, all I can do is hard code the password into the plugin which is NOT a good option.

    Is there a way that we can tell get_option() to NOT run the returned value through stripslashes()?

Viewing 2 replies - 1 through 2 (of 2 total)
  • If the preBind username has a slash in it, am I to assume you’re using the DOMAIN\username syntax for Active Directory? You could try username@fqdn instead.

    Upgrading to WP 2.7 broke account creation with wpDirAuth, but owners of existing accounts can still log in. I presume that’s a different problem.

    mattifesto
    Member

    @mattifesto

    I’m writing a plugin and testing it on WordPress 2.8.4, and it seems that now you must call stripslashes on all values returned from get_option.

    I would think the correct thing would be for WordPress to do this for you as described above, since it update_option the slashes for you in the first place.

    Can someone please definitively say whether stripslashes is supposed to be required or not?

    My guess is that they tried to add it in, but it broke too much stuff and they had to take it out again. But either way, it should be documented in the get_option function reference. We just need to know how it’s supposed to be.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_option and stripslashes’ is closed to new replies.