WordPress.org

Make WordPress Core

Ticket #14201: 14201.2.patch

File 14201.2.patch, 1.7 KB (added by hakre, 8 years ago)

Don't interfere with Permalink Generation

  • wp-includes/category-template.php

     
    1717 */
    1818function get_category_link( $category_id ) {
    1919        global $wp_rewrite;
    20         $catlink = $wp_rewrite->get_category_permastruct();
     20        $catlink = urlencode( $wp_rewrite->get_category_permastruct() );
    2121
    2222        if ( empty( $catlink ) ) {
    2323                $catlink = home_url('?cat=' . $category_id);
     
    3232                elseif ($category->parent != 0 )
    3333                        $category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename;
    3434
    35                 $catlink = str_replace( '%category%', $category_nicename, $catlink );
     35                $catlink = str_replace( '%25category%25', $category_nicename, $catlink );
     36                $catlink = str_replace( '%2F', '/', $catlink );
    3637                $catlink = home_url( user_trailingslashit( $catlink, 'category' ) );
    3738        }
    3839        return apply_filters( 'category_link', $catlink, $category_id );
     
    792793 */
    793794function get_tag_link( $tag_id ) {
    794795        global $wp_rewrite;
    795         $taglink = $wp_rewrite->get_tag_permastruct();
     796        $taglink = urlencode( $wp_rewrite->get_tag_permastruct() );
    796797
    797798        $tag = &get_term( $tag_id, 'post_tag' );
    798799        if ( is_wp_error( $tag ) )
     
    803804                $file = get_option( 'home' ) . '/';
    804805                $taglink = $file . '?tag=' . $slug;
    805806        } else {
    806                 $taglink = str_replace( '%tag%', $slug, $taglink );
     807                $taglink = str_replace( '%25tag%25', $slug, $taglink );
     808                $taglink = str_replace( '%2F', '/', $taglink );
    807809                $taglink = get_option( 'home' ) . user_trailingslashit( $taglink, 'category' );
    808810        }
    809811        return apply_filters( 'tag_link', $taglink, $tag_id );