• During the years, syncing with other tools who sometimes have “space” between tags (but where you use commas) i build up a collection of tags who have commas in them.

    I can not simply replace them in the database because at the same time the tag WITHOUT comma is used. So the related posts with comma tag should move to the posts without comma tag and only then remove the tag.

    Before I code this, has anyone this piece of code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cogmios

    (@cogmios)

    So for each of these terms I will have to

    1) find the corresponding tag without a comma

    1a) if it exists temporarily store it
    1b) if it does not exist then simply rename the name and slug and go to the next tag

    2) find the entries in the wp_term_taxonomy table and count the references and the key
    3) use this key to find the entries in the wp_term_relationships table
    4) link them to the stored tag without a comma (in other words replace the term_taxonomy_id in wp_term_relationships)
    5) and then remove the tag in the wp_terms and wp_term_tanxomy table

    This loop would do it.

    Thread Starter cogmios

    (@cogmios)

    (and since it are a LOT of tags I dont want to merge them manually)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove comma from tags’ is closed to new replies.