WordPress.org

Make WordPress Core

Ticket #5110: in_category.diff

File in_category.diff, 602 bytes (added by stormerider, 8 years ago)

Patch to add sanity checking to $category value

Line 
1*** /home/amorgan/www/tech/wp-includes/category-template.php    Tue Sep 18 09:32:22 2007
2--- /home/amorgan/www/amorgan/wp-includes/category-template.php Tue Oct  9 07:54:14 2007
3***************
4*** 170,175 ****
5--- 170,177 ----
6  function in_category( $category ) { // Check if the current post is in the given category
7        global $post, $blog_id;
8
9+       if ($category == '')
10+               return false;
11        $categories = get_object_term_cache($post->ID, 'category');
12        if ( false === $categories )
13                $categories = wp_get_object_terms($post->ID, 'category');