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

  1. Ahni
    Posted 3 years 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.


  2. Chris
    Plugin Author

    Posted 3 years 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
    Posted 3 years 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


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

  4. Chris
    Plugin Author

    Posted 3 years 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
    Posted 3 years ago #

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

  6. Chris
    Plugin Author

    Posted 3 years ago #

    You are welcome! And thank you for testing!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Tag Groups
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.