From 9168d77a755fc44bc89257882749382ac831afc3 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 10 Mar 2011 04:25:40 +0000 Subject: [PATCH] Correctly handle PATHINFO CPTs and CTs that specify with_front=false. fixes #16807 for 3.1 git-svn-id: http://svn.automattic.com/wordpress/branches/3.1@17519 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 2 ++ wp-includes/post.php | 2 ++ wp-includes/rewrite.php | 2 ++ wp-includes/version.php | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 33f0a7dd50..0d582bf11c 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -847,6 +847,8 @@ function get_post_type_archive_link( $post_type ) { $struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive; if ( $post_type_obj->rewrite['with_front'] ) $struct = $wp_rewrite->front . $struct; + else + $struct = $wp_rewrite->root . $struct; $link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) ); } else { $link = home_url( '?post_type=' . $post_type ); diff --git a/wp-includes/post.php b/wp-includes/post.php index 8b80146806..191b42c5d2 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -987,6 +987,8 @@ function register_post_type($post_type, $args = array()) { $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive; if ( $args->rewrite['with_front'] ) $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug; + else + $archive_slug = $wp_rewrite->root . $archive_slug; $wp_rewrite->add_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' ); if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) { diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 839d2aeefc..92d372e383 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -1857,6 +1857,8 @@ class WP_Rewrite { function add_permastruct($name, $struct, $with_front = true, $ep_mask = EP_NONE) { if ( $with_front ) $struct = $this->front . $struct; + else + $struct = $this->root . $struct; $this->extra_permastructs[$name] = array($struct, $ep_mask); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 70dc6fcd22..fa1af967fe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -29,7 +29,7 @@ $wp_version = '3.1.1-alpha-17490'; * * @global int $wp_db_version */ -$wp_db_version = 17510; +$wp_db_version = 17516; /** * Holds the TinyMCE version