From 59f5dff47664a84fc7f232441fabc637df5e6e0e Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 10 Mar 2011 04:24:48 +0000 Subject: [PATCH] Correctly handle PATHINFO CPTs and CTs that specify with_front=false. fixes #16807 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@17518 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 33f0a7dd5..0d582bf11 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 8b8014680..191b42c5d 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 839d2aeef..92d372e38 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 b3c63d057..2e5ad6fd6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -29,7 +29,7 @@ $wp_version = '3.2-bleeding'; * * @global int $wp_db_version */ -$wp_db_version = 17510; +$wp_db_version = 17516; /** * Holds the TinyMCE version