Update table wp_term_taxonomy.count after INSERT INTO via SQL
You can just run the wp_update_term_count_now php function after doing this: https://developer.wordpress.org/reference/functions/wp_update_term_count_now/ Which calls the private _update_post_term_count https://developer.wordpress.org/reference/functions/_update_post_term_count/ If you look at the source of that you will see how term counts are updated (which is done when you save a post on backend): function _update_post_term_count( $terms, $taxonomy ) { global $wpdb; $object_types = (array) … Read more