- } elseif ( null !== get_post_type_object( $object_type ) ) {
- $object = get_post($object_id);
- if ( ! is_wp_error( $object ) && isset( $object->ancestors ) && is_array( $object->ancestors ) )
- $ancestors = $object->ancestors;
- else {
- while ( ! is_wp_error($object) && ! empty( $object->post_parent ) && ! in_array( $object->post_parent, $ancestors ) ) {
- $ancestors[] = (int) $object->post_parent;
- $object = get_post($object->post_parent);
- }
- }