Silently add /index.php/ to category_base and tag_base for blogs using PATHINFO permalinks. fixes #4536

git-svn-id: http://svn.automattic.com/wordpress/trunk@8213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-06-29 08:20:25 +00:00
parent a8dd6cb845
commit eb3a3bae78
2 changed files with 16 additions and 2 deletions

View File

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

View File

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