Use is_page_type_hierarchical(). props nacin. see #15140

git-svn-id: https://develop.svn.wordpress.org/trunk@16819 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2010-12-08 21:17:01 +00:00
parent 08671532d3
commit 956b191c60
2 changed files with 2 additions and 4 deletions

View File

@ -4025,8 +4025,7 @@ function wp_check_for_changed_slugs($post_id, $post, $post_before) {
return;
// we're only concerned with published, non-hierarchical objects
$ptype_obj = get_post_type_object( $post->post_type );
if ( $post->post_status != 'publish' || !$ptype_obj || $ptype_obj->hierarchical )
if ( $post->post_status != 'publish' || is_post_type_hierarchical( $post->post_type ) )
return;
$old_slugs = (array) get_post_meta($post_id, '_wp_old_slug');

View File

@ -3232,8 +3232,7 @@ function wp_old_slug_redirect() {
$post_type = 'post';
// Do not attempt redirect for hierarchical post types
$ptype_obj = get_post_type_object( $post_type );
if ( !$ptype_obj || $ptype_obj->hierarchical )
if ( is_post_type_hierarchical( $post_type ) )
return;
$query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']);