WordPress.org

Make WordPress Core

Ticket #14485: garyc40-14485-documented.patch

File garyc40-14485-documented.patch, 1.7 KB (added by garyc40, 3 years ago)

Added documentation for $force_clean_taxonomy

  • wp-includes/taxonomy.php

     
    20012001 
    20022002        $term_id = apply_filters('term_id_filter', $term_id, $tt_id); 
    20032003 
    2004         clean_term_cache($term_id, $taxonomy); 
     2004        $force_clean_taxonomy = ( $parent ) ? true : false; 
     2005        clean_term_cache($term_id, $taxonomy, true, $force_clean_taxonomy); 
    20052006 
    20062007        do_action("created_term", $term_id, $tt_id, $taxonomy); 
    20072008        do_action("created_$taxonomy", $term_id, $tt_id); 
     
    24402441 * @param int|array $ids Single or list of Term IDs 
    24412442 * @param string $taxonomy Can be empty and will assume tt_ids, else will use for context. 
    24422443 * @param bool $clean_taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true. 
     2444 * @param bool $force_clean_taxonomy Whether to force clean taxonomy wide caches (true), or skip if it's already done (false). Default is false. 
     2445 *  
    24432446 */ 
    2444 function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) { 
     2447function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true, $force_clean_taxonomy = false) { 
    24452448        global $wpdb; 
    24462449        static $cleaned = array(); 
    24472450 
     
    24712474        } 
    24722475 
    24732476        foreach ( $taxonomies as $taxonomy ) { 
    2474                 if ( isset($cleaned[$taxonomy]) ) 
     2477                if ( isset($cleaned[$taxonomy]) && ! $force_clean_taxonomy ) 
    24752478                        continue; 
    24762479                $cleaned[$taxonomy] = true; 
    24772480 
     
    24862489                do_action('clean_term_cache', $ids, $taxonomy); 
    24872490        } 
    24882491 
    2489         wp_cache_set('last_changed', time(), 'terms'); 
     2492        $last_changed = substr( md5( implode( ',', $ids ) . ':' . time() ), 0, 6 ); 
     2493        wp_cache_set('last_changed', $last_changed, 'terms'); 
    24902494}