WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] problem with term containing ampsersand when calling wp_set_post_terms() (3 posts)

  1. RRikesh
    Member
    Posted 1 year ago #

    I don't know if I'm doing something wrong. When I am calling wp_set_post_terms with a term containing an ampersand, a new term with that name is being created.

    eg
    wp_set_post_terms( $post_id, $taxo[$term]->name , $taxonomy, $append );

    where $taxo[$term]->name = 'lorem & ipsum'

    However, when I rename the term to 'lorem and ipsum' I don't have any issues.

  2. s_ha_dum
    Member
    Posted 1 year ago #

    I bet you have an encoding problem. Something like this.... when lorem & ipsum is inserted, it is converted to lorem & ipsum, which doesn't match lorem & ipsum when you try to use the term resulting in the creation of a new term. That is speculation and exactly when and the where the encoding occurs may be wrong, but I think something like that is happening. It might be worth searching the Trac.

  3. RRikesh
    Member
    Posted 1 year ago #

    Thanks for the help. I couldn't get it to work though. Used 'and' instead of the ampersand to get away with this problem meanwhile.

Topic Closed

This topic has been closed to new replies.

About this Topic