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
This commit is contained in:
markjaquith 2011-03-10 04:24:48 +00:00
parent acb3938c8a
commit 59f5dff476
4 changed files with 7 additions and 1 deletions

View File

@ -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 );

View File

@ -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 ) {

View File

@ -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);
}

View File

@ -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