Support » Developing with WordPress » wp_editor problems with linkks

  • Hi,
    I’m developing a plugin and I’m using wp_editor.
    It works fine, except for the links. When a link is created, the text is saved into the database with a backslash after the =. This is an example:

    <p><a href="http://www.wordpress.org">www.wordpress.org</a></p>

    This is the code:

    
    <?php $args = array(
                    'editor_height' => 200,
                    'media_buttons' => false,
                    'teeny' => true,
                    'dfw' => false,
                    'tinymce' => true,
                    'wpautop' => false,
                    'quicktags' => true
                );
    
                $str = stripslashes($item['description']);
                wp_editor($str, 'description', $args );
                ?>
    

    Do you konow what the problem may be?

    Thanks in advance!

    Josep

    • This topic was modified 9 months, 2 weeks ago by Jan Dembowski. Reason: Formatting
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Only after the =? Not before other quotes in the content, like the closing quote in <a href="http://www.wordpress.org">?

    How is the editor content saved? Normally quotes are escaped with backslashes when data comes in from the browser. Code should strip slashes and validate, sanitize data before inserting into the DB

    Thread Starter josepsitjar

    (@josepsitjar)

    Yes @bcworkz
    This only happens after the =

    href=\”http://www.worpdress.org&#8221;

    And this makes the link not work properly when the content is published.

    The form inserts the content on the database in html.

    I don’t know how I could solve this problem

    • This reply was modified 9 months, 2 weeks ago by josepsitjar.
    • This reply was modified 9 months, 2 weeks ago by josepsitjar.
    Moderator bcworkz

    (@bcworkz)

    The proper fix involves finding out why the one slash remains. It’s normal for all quotes to be slashed when data comes into the server. Sever code typically runs data through stripslashes() before saving. It’s quite odd that the one slash still remains, I’ve no idea why, so a proper fix isn’t apparent.

    I suppose you could add code to the server that runs the data through stripslashes() once more before saving.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_editor problems with linkks’ is closed to new replies.