WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy anomaly (1 post)

  1. scrollpost
    Member
    Posted 3 years ago #

    I am making wordpress posts programmatically with multiple taxonomies.
    There is a mix of hierarchical and flat taxonomies.

    For the hierarchical taxonomy I am using the taxonomy id via a "term_exists" query.
    NO PROBLEM.

    But along the way I converted one taxonomy from flat to hierarchical and forgot to switch from using the string of the term to the ID and it still worked.
    BEFORE I proceed, please note I have read in the codex that this is NOT recommended and why, but I have no name conflicts.

    The problem I am having is when I use "get_the_term_list" to retrieve that taxonomy to combine it with a current date and convert it to a hash tag for twitter.

    First I explode the term list into an array.
    Then I loop though the array with a foreach.
    First I combine the foreach variable with the date.
    NO PROBLEM.

    BUT in the next line using the same variable I use a substr to limit the term to 3 characters for the hash tag, BUT the result is the first three characters of an anchor. I tested this without the substr and indeed the variable contained an anchor.

    I don't understand why there is this anomaly.

    I tested the term-date taxonomy to see if it works properly and it does.

Topic Closed

This topic has been closed to new replies.

About this Topic