Support » Fixing WordPress » problem with term containing ampsersand when calling wp_set_post_terms()

  • Resolved RRikesh

    (@rrikesh)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    Thread Starter RRikesh

    (@rrikesh)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘problem with term containing ampsersand when calling wp_set_post_terms()’ is closed to new replies.