Make WordPress Core

Changeset 8213


Ignore:
Timestamp:
06/29/2008 08:20:25 AM (16 years ago)
Author:
markjaquith
Message:

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

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-filters.php

    r8011 r8213  
    154154add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
    155155add_filter('comment_email', 'antispambot');
     156add_filter('option_tag_base', '_wp_filter_taxonomy_base');
     157add_filter('option_category_base', '_wp_filter_taxonomy_base');
    156158
    157159//Atom SSL support
  • trunk/wp-includes/rewrite.php

    r8179 r8213  
    5959    global $wp_rewrite;
    6060    $wp_rewrite->add_endpoint($name, $places);
     61}
     62
     63/**
     64  * _wp_filter_taxonomy_base() - filter the URL base for taxonomies, to remove any manually prepended /index.php/
     65  * @param string $base the taxonomy base that we're going to filter
     66  * @return string
     67  * @author Mark Jaquith
     68  */
     69function _wp_filter_taxonomy_base( $base ) {
     70    if ( !empty( $base ) )
     71        $base = preg_replace( '|^/index\.php/|', '/', $base );
     72    return $base;
    6173}
    6274
     
    982994            $this->root = $this->index . '/';
    983995        }
    984         $this->category_base = get_option( 'category_base' );
    985         $this->tag_base = get_option( 'tag_base' );
     996        $this->category_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'category_base' );
     997        $this->tag_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'tag_base' );
    986998        unset($this->category_structure);
    987999        unset($this->author_structure);
Note: See TracChangeset for help on using the changeset viewer.