#17140 closed defect (bug) (worksforme)
get_terms() after wp_update_term() gives old list
Reported by: | mastermind | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | close |
Focuses: | Cc: |
Description
When you call get_terms() after you have modified a term via wp_update_term(), you still get the old list.
Workaround: Call wp_flush_cache() after wp_update_term(). (Obviously, a performance killer.)
Change History (6)
#2
@
13 years ago
- Milestone Awaiting Review deleted
- Status changed from new to closed
Related: #14485
#3
@
13 years ago
- Status changed from closed to reopened
Didn't mean to close without a resolution.
Actually, can't reproduce on current trunk:
$category = get_term(1, 'category'); $category->slug = 'uncategorized' . current_time('timestamp'); wp_update_term( $category->term_id, 'category', array( 'slug' => $category->slug ) ); var_dump( $category ); var_dump( get_terms('category') );
get_terms()
returns the updated term as well. Looks like fixed in 3.2.
Note: See
TracTickets for help on using
tickets.
The solution would be to not call get_terms() in the same page load.
WP handles it by always doing a redirect after any edit.