Ok so I'm writing a piece of php code that will automatically give (add) tags to posts based on logics.
Quick example: Any post that has "Europe" in either the post_content or post_title should be tagged with "Europe".
I've gotten as far as to be able to get all the post_id's from all posts that need to be tagged, I got the id of the post_tag "Europe", and if it doesn't exist I will first insert it and then get the ID, but I've come across a problem.
The problem is: when I update the tables:
To completely match what is needed, this meaning:
- (optional: insert into wp_terms if not exists) and get the term_id
- (optional: insert into wp_term_taxonomy if not exists) and get the term_taxonomy_id
- (optional: insert into wp_term_relationships if not exists AND increase the "count" in wp_term_taxonomy by 1)
However! wordpress does not tag the post, but everything in the database is correctly edited/inserted....
What am I not seeing?