X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..874d2a2f468a0d1e69aab49b1fe2d9d79d3e1142:/wp-includes/link-template.php?ds=sidebyside diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 7a7b7874..d0264e52 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -257,10 +257,12 @@ function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { $post_type = get_post_type_object($post->post_type); + if ( $post_type->hierarchical ) { + $slug = get_page_uri( $id ); + } + if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) { if ( ! $leavename ) { - if ( $post_type->hierarchical ) - $slug = get_page_uri($id); $post_link = str_replace("%$post->post_type%", $slug, $post_link); } $post_link = home_url( user_trailingslashit($post_link) ); @@ -1511,7 +1513,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo } if ( ! empty( $excluded_terms ) ) { - $where .= " AND p.ID NOT IN ( SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . implode( $excluded_terms, ',' ) . ') )'; + $where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( $excluded_terms, ',' ) . ') )'; } }