Imported posts and terms but terms not appearing on the frontend
I created a giant import that grabbed both taxonomy terms and posts from a different application. To import the terms I used wp_set_post_terms( $post_id, $term_ids, 'my_taxonomy' );
which works because I see them on the edit screen for each post.
However, when I go on the frontend and look at my post the terms are empty. If I go back on the edit screen and just click on "Save" then they finally appear on the front end.
I have close to 2,000 records and doing this manually would be quite unwieldy and I can’t for the life of me figure out what happened! How do I force this update across the board programmatically?
I’ve tried using both clean_term_cache();
and clean_object_term_cache();
and it didn’t seem to make a difference. Maybe I’m calling these wrong but it’s not doing a thing as far as I can tell.
I’ve tried:
- clean_term_cache
- clean_object_term_cache
- delete_option($tax.’-slug_children’);
- delete_option($tax.’_children’);
- clean_taxonomy_cache($tax);
- wp_cache_flush();
Leave an answer
You must login or register to add a new answer .