Ticket #16415: 16415.2.diff
File 16415.2.diff, 2.4 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
1041 1041 $args->rewrite['with_front'] = true; 1042 1042 if ( ! isset( $args->rewrite['pages'] ) ) 1043 1043 $args->rewrite['pages'] = true; 1044 if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive)1044 if ( ! isset( $args->rewrite['feeds'] ) && isset( $args->has_archive ) ) 1045 1045 $args->rewrite['feeds'] = (bool) $args->has_archive; 1046 1046 if ( ! isset( $args->rewrite['ep_mask'] ) ) { 1047 1047 if ( isset( $args->permalink_epmask ) ) … … 1055 1055 else 1056 1056 add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name="); 1057 1057 1058 $archive_slug = ( is_string( $args->has_archive ) && strlen( $args->has_archive ) ) ? $args->has_archive : $args->rewrite['slug']; 1059 if ( $args->rewrite['with_front'] ) 1060 $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug; 1061 else 1062 $archive_slug = $wp_rewrite->root . $archive_slug; 1063 1064 if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) { 1065 $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; 1066 add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); 1067 add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); 1068 } 1069 1058 1070 if ( $args->has_archive ) { 1059 $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;1060 if ( $args->rewrite['with_front'] )1061 $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;1062 else1063 $archive_slug = $wp_rewrite->root . $archive_slug;1064 1065 1071 add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' ); 1066 if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {1067 $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';1068 add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );1069 add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );1070 }1071 1072 if ( $args->rewrite['pages'] ) 1072 1073 add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' ); 1073 1074 }