diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index bba6608c38..011a1ed4be 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -153,6 +153,8 @@ add_action('check_comment_flood', 'check_comment_flood_db', 10, 3); add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3); add_filter('pre_comment_content', 'wp_rel_nofollow', 15); add_filter('comment_email', 'antispambot'); +add_filter('option_tag_base', '_wp_filter_taxonomy_base'); +add_filter('option_category_base', '_wp_filter_taxonomy_base'); //Atom SSL support add_filter('atom_service_url','atom_service_url_filter'); diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index d4a5864703..8a13a335f0 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -60,6 +60,18 @@ function add_rewrite_endpoint($name, $places) { $wp_rewrite->add_endpoint($name, $places); } +/** + * _wp_filter_taxonomy_base() - filter the URL base for taxonomies, to remove any manually prepended /index.php/ + * @param string $base the taxonomy base that we're going to filter + * @return string + * @author Mark Jaquith + */ +function _wp_filter_taxonomy_base( $base ) { + if ( !empty( $base ) ) + $base = preg_replace( '|^/index\.php/|', '/', $base ); + return $base; +} + // examine a url (supposedly from this blog) and try to // determine the post ID it represents. function url_to_postid($url) { @@ -981,8 +993,8 @@ class WP_Rewrite { if ($this->using_index_permalinks()) { $this->root = $this->index . '/'; } - $this->category_base = get_option( 'category_base' ); - $this->tag_base = get_option( 'tag_base' ); + $this->category_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'category_base' ); + $this->tag_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'tag_base' ); unset($this->category_structure); unset($this->author_structure); unset($this->date_structure);