Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_category

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
146           wp_cache_add($category->cat_ID, $category, 'category');
147           $_category = $category;
148      } else {
149           if ( ! $_category = wp_cache_get($category, 'category') ) {
150                $_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1");
151                wp_cache_set($category, $_category, 'category');
152           }
153      }
154
155      $_category = apply_filters('get_category', $_category);
156
157      if ( $output == OBJECT ) {
158           return $_category;
159      } elseif ( $output == ARRAY_A ) {
160           return get_object_vars($_category);
161      } elseif ( $output == ARRAY_N ) {
162           return array_values(get_object_vars($_category));
163      } else {
164           return $_category;