diff options
Diffstat (limited to 'wp-includes/rewrite.php')
-rw-r--r-- | wp-includes/rewrite.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 8a13a33..15247d8 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -67,8 +67,10 @@ function add_rewrite_endpoint($name, $places) { * @author Mark Jaquith */ function _wp_filter_taxonomy_base( $base ) { - if ( !empty( $base ) ) - $base = preg_replace( '|^/index\.php/|', '/', $base ); + if ( !empty( $base ) ) { + $base = preg_replace( '|^/index\.php/|', '', $base ); + $base = trim( $base, '/' ); + } return $base; } @@ -150,7 +152,7 @@ function url_to_postid($url) { $query = preg_replace("!^.+\?!", '', $query); // Substitute the substring matches into the query. - eval("\$query = \"$query\";"); + eval("\$query = \"" . addslashes($query) . "\";"); // Filter out non-public query vars global $wp; parse_str($query, $query_vars); @@ -445,9 +447,9 @@ class WP_Rewrite { } if (empty($this->category_base)) - $this->category_structure = $this->front . 'category/'; + $this->category_structure = trailingslashit( $this->front . 'category' ); else - $this->category_structure = $this->category_base . '/'; + $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base ); $this->category_structure .= '%category%'; @@ -465,9 +467,9 @@ class WP_Rewrite { } if (empty($this->tag_base)) - $this->tag_structure = $this->front . 'tag/'; + $this->tag_structure = trailingslashit( $this->front . 'tag' ); else - $this->tag_structure = $this->tag_base . '/'; + $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base ); $this->tag_structure .= '%tag%'; @@ -993,8 +995,8 @@ class WP_Rewrite { if ($this->using_index_permalinks()) { $this->root = $this->index . '/'; } - $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' ); + $this->category_base = get_option( 'category_base' ); + $this->tag_base = get_option( 'tag_base' ); unset($this->category_structure); unset($this->author_structure); unset($this->date_structure); |