Silently add /index.php/ to category_base and tag_base for blogs using PATHINFO permalinks. fixes #4536
git-svn-id: https://develop.svn.wordpress.org/trunk@8213 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
817cb02671
commit
cab4a6a625
@ -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');
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user