WordPress.org

Ready to get started?Download WordPress

Forums

Tag Groups
[resolved] small problem: saving terms strips out html (6 posts)

  1. Ahni
    Member
    Posted 1 year ago #

    Hey again. I just noticed, whenever I save a term now it strips out any images and basic html (links, italics) I've added in. Up to now I've been using this code so that I can use html in descriptions. I also just tested with the plugin "Rich Text Tags, Categories, and Taxonomies" but it's the same thing. I can add html no problem, but the second I save it it's gone.

    http://wordpress.org/extend/plugins/tag-groups/

  2. Chris
    Member
    Plugin Author

    Posted 1 year ago #

    You mean it has to do with the plugin? If you disable the plugin, put html in the description and save the term, it is still there?
    The only thing I could imagine where it happens is in the plugin line 227:

    if ( isset($_POST['description']) && ($_POST['description'] != '') ) $term['description'] = stripslashes(sanitize_text_field($_POST['description']));

    You could try to remove the sanitize_text_field( ) and see if that helps.

  3. Ahni
    Member
    Posted 1 year ago #

    Yes, it's definitely a plugin issue. As soon as I disabled it, all my html was preserved as per usual.

    I tried removing sanitize_text_field( ) like you suggested, specifically

    sanitize_text_field($_POST['description'])

    Unfortunately, when I saved tried saving a term, it deleted the entire description!

  4. Chris
    Member
    Plugin Author

    Posted 1 year ago #

    sorry, my suggestion was somewhat ambiguous. Actually I meant only to take out the function, but leave the inner bit $_POST['description'] .
    That line would thus become:

    if ( isset($_POST['description']) && ($_POST['description'] != '') ) $term['description'] = stripslashes($_POST['description']);

    I tested the change here and it seems to make a difference.
    I did not know that html is allowed in the description but it indeed makes sense.

  5. Ahni
    Member
    Posted 1 year ago #

    Hooray, it worked!! I owe you one, big time, for making this plugin and for the awesome support. Thank you!

  6. Chris
    Member
    Plugin Author

    Posted 1 year ago #

    You are welcome! And thank you for testing!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.