Changeset 4519
- Timestamp:
- 11/23/06 16:52:42 (2 years ago)
- Files:
-
- trunk/wp-includes/category.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/category.php
r4219 r4519 30 30 $r['number'] = (int) $r['number']; 31 31 extract($r); 32 33 $key = md5( serialize( $r ) ); 34 if ( $cache = wp_cache_get( 'get_categories', 'category' ) ) 35 if ( isset( $cache[ $key ] ) ) 36 return $cache[ $key ]; 32 37 33 38 $where = 'cat_ID > 0'; … … 120 125 reset ( $categories ); 121 126 127 $cache[ $key ] = $categories; 128 wp_cache_set( 'get_categories', $cache, 'category' ); 129 122 130 return apply_filters('get_categories', $categories, $r); 123 131 } 132 133 function delete_get_categories_cache() { 134 wp_cache_delete('get_categories', 'category'); 135 } 136 add_action( 'wp_insert_post', 'delete_get_categories_cache' ); 137 add_action( 'edit_category', 'delete_get_categories_cache' ); 138 add_action( 'add_category', 'delete_get_categories_cache' ); 139 add_action( 'delete_category', 'delete_get_categories_cache' ); 124 140 125 141 // Retrieves category data given a category ID or category object.
