PHP Code Widget
Escape Slashes Not Kept (3 posts)

  1. Seth
    Posted 4 years ago #

    I'm trying to use this plugin but my escape slashes are removed when I save the widget code.


    function nl2br2($string) {
    $string = str_replace(array("\r\n", "\r", "\n"), "<br />", $string);
    return $string;

    Turns to

    function nl2br2($string) {
    $string = str_replace(array("rn", "r", "n"), "<br />", $string);
    return $string;

    Any thoughts?


  2. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 4 years ago #

    Does it still happen if you turn off the automatic paragraph stuff?

    Looking through the code, it runs the text through wpautop() if you have that enabled.

    It also runs it through wp_filter_post_kses() if you don't have the unfiltered_html capability.

  3. Seth
    Posted 4 years ago #

    Yes, it still happens with automatic paragraph checked and unchecked. I'm only a novice at WP, but there must have been a change to the WP back-end in one of the updates. It didn't happen before I upgraded to WP 3.1 -- I had escaped PHP scripts and they were working just fine. Then I went to make a change and when I saved the change at the widget, I noticed the problem.

    I'm not familiar with wpautop(), but will look into its settings.

    - Seth

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic