WordPress.org

Make WordPress Core

Changeset 14696


Ignore:
Timestamp:
05/16/10 20:47:18 (5 years ago)
Author:
westi
Message:

Switch to checking on tt_ids for the category lookup to ensure in_array call is PHP4 compatible. See #13410

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r14595 r14696  
    182182        } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) { 
    183183            $category = get_term_by('slug', get_query_var('category_name'), 'category'); 
    184             $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category'); 
    185             if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category, $post_terms) ) ) 
     184            $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids')); 
     185            if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) ) 
    186186                $redirect_url = get_permalink($wp_query->get_queried_object_id()); 
    187187        } 
Note: See TracChangeset for help on using the changeset viewer.