Could anyone tell me how exactly tags are stored in the database?
At the moment, I had the impression that this data was stored in 3 tables, but when I manually add rows to these tables (SQL queries), WordPress doesn’t see the post has been tagged with anything, even though it really is correct in the database (in those 3 tables).
What I thought:
=> Table where terms (tags & categories) are stored, based on a term_id
=> Table where term_id’s are linked to a term_taxonomy_id (to combine terms and posts later on), where its stored whether it is a tag or a category, who the parent-category could be, …
=> Table which stores the relationship of a term_taxonomy_id and an object_id (which is a post_id)
But… If I manually add rows to these 3 tables, as said before, wordpress doesn’t see posts actually are tagged…
Tags are a WordPress taxonomy. A tag is named in table <prefix>_terms. It is assigned to a taxonomy in table <prefix>_term_taxonomy. It is then associated with a post in the table <prefix>_term_relationships.