• Resolved Ambyomoron

    (@josiah-s-carberry)


    In note that WordPress creates by default a taxonomy called ‘post_format’ a single term in that taxonomy: ‘post-format-gallery’.

    One of my posts has a relationship with that term, a relationship that should not exist. I have no idea how that relationship had been created and I cannot find how to remove it programmatically.

    I know for sure that I did not create this relationship by tinkering with the database, so I assume that it must have happened in the context of a theme or a plugin. However, none of my plugins make any reference at all to this taxonomy and the theme provides no functionality at all for linking a post to a post format (using the post_format taxonomy).

    So, does anyone have an idea
    1) how this erroneous relationship might have come about; and
    2) how to remove the relationship programmatically; and if that is not possible
    3) what to look out for when simply deleting the relevant row from the wp_term_relationships table.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Any theme that supports post formats that may have been in use in the past could have assigned the term.

    You can use wp_set_post_terms() to actually unset terms for a post by passing an empty string for $tags (and passing 'post_format' for $taxonomy of course). This should be effective whether your current theme supports post formats or not.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Thanks very much. That seems to have done the trick. I note that the taxonomy term itself is still there. How would I get rid of that (or could I simply delete the row from the table)?

    Moderator bcworkz

    (@bcworkz)

    In wp_terms? If there are no references to it in wp_term_taxonomy then yes, the row could be removed. Be sure there are no related wp_termmeta entries, or remove those too.

    But to be more “proper”, use wp_delete_term().

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Thanks again. I’m getting the hang of how to do this stuff.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘error in taxonomy post_format’ is closed to new replies.