WordPress.org

Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #14485, comment 60


Ignore:
Timestamp:
12/16/2012 11:02:38 AM (5 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14485, comment 60

    v3 v4  
    11For me, it seems to be choice between:
    2 
     2{{{
    33wp_cache_flush();
    4 
     4}}}
    55and a more targeted approach:
    6 
     6{{{
    77function force_flush_term_cache( $taxonomy = 'category' ) {
    88        if ( !taxonomy_exists( $taxonomy ) ) return FALSE;
    99
    10         wp_cache_set( 'last_changed', time( ) - 1800, 'terms' );[[BR]]
    11         wp_cache_delete( 'all_ids', $taxonomy );[[BR]]
    12         wp_cache_delete( 'get', $taxonomy );[[BR]]
    13         delete_option( "{$taxonomy}_children" );[[BR]]
    14         _get_term_hierarchy( $taxonomy );[[BR]]
    15         return TRUE;[[BR]]
     10        wp_cache_set( 'last_changed', time( ) - 1800, 'terms' );
     11        wp_cache_delete( 'all_ids', $taxonomy );
     12        wp_cache_delete( 'get', $taxonomy );
     13        delete_option( "{$taxonomy}_children" );
     14        _get_term_hierarchy( $taxonomy );
     15        return TRUE;
    1616}
     17}}}