Ticket #13318: 13318.get-terms-custom-arg-3.diff
File 13318.get-terms-custom-arg-3.diff, 1.9 KB (added by , 14 years ago) |
---|
-
wp-includes/taxonomy.php
1129 1129 * The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent' 1130 1130 * of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc. 1131 1131 * 1132 * The 'custom_cache_key' argument, if set to true, will use all arguments passed in $args to 1133 * generate the cache key. Only recognized arguments will be used if it is set to false. 1134 * Its default value is false. 1135 * 1132 1136 * @package WordPress 1133 1137 * @subpackage Taxonomy 1134 1138 * @since 2.3.0 … … 1161 1165 'hide_empty' => true, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(), 1162 1166 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 1163 1167 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 1164 'pad_counts' => false, 'offset' => '', 'search' => '' );1168 'pad_counts' => false, 'offset' => '', 'search' => '', 'custom_cache_key' => false ); 1165 1169 $args = wp_parse_args( $args, $defaults ); 1166 1170 $args['number'] = absint( $args['number'] ); 1167 1171 $args['offset'] = absint( $args['offset'] ); … … 1195 1199 return $empty_array; 1196 1200 } 1197 1201 1198 // $args can be whatever, only use the args defined in defaults to compute the key 1202 $prefix = ( $args['custom_cache_key'] ) ? $args : $defaults; 1203 unset( $prefix['custom_cache_key'] ); 1199 1204 $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : ''; 1200 $key = md5( serialize( compact( array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );1205 $key = md5( serialize( compact( array_keys( $prefix ) ) ) . serialize( $taxonomies ) . $filter_key ); 1201 1206 $last_changed = wp_cache_get('last_changed', 'terms'); 1202 1207 if ( !$last_changed ) { 1203 1208 $last_changed = time();