Make WordPress Core


Ignore:
Timestamp:
08/20/2012 07:47:52 PM (12 years ago)
Author:
ryan
Message:

Introduce WP_Post class. Clean up ancestors handling. Props scribu, toppa. fixes #10381 see #21309

File:
1 edited

Legend:

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

    r21553 r21559  
    32223222            $term = get_term($term->parent, $object_type);
    32233223        }
    3224     } elseif ( null !== get_post_type_object( $object_type ) ) {
    3225         $object = get_post($object_id);
    3226         if ( ! is_wp_error( $object ) && isset( $object->ancestors ) && is_array( $object->ancestors ) )
    3227             $ancestors = $object->ancestors;
    3228         else {
    3229             while ( ! is_wp_error($object) && ! empty( $object->post_parent ) && ! in_array( $object->post_parent, $ancestors ) ) {
    3230                 $ancestors[] = (int) $object->post_parent;
    3231                 $object = get_post($object->post_parent);
    3232             }
    3233         }
     3224    } elseif ( post_type_exists( $object_type ) ) {
     3225        $ancestors = get_post_ancestors($object_id);
    32343226    }
    32353227
Note: See TracChangeset for help on using the changeset viewer.