Make WordPress Core

Ticket #16415: 16415.2.diff

File 16415.2.diff, 2.4 KB (added by SergeyBiryukov, 13 years ago)
  • wp-includes/post.php

     
    10411041                        $args->rewrite['with_front'] = true;
    10421042                if ( ! isset( $args->rewrite['pages'] ) )
    10431043                        $args->rewrite['pages'] = true;
    1044                 if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive )
     1044                if ( ! isset( $args->rewrite['feeds'] ) && isset( $args->has_archive ) )
    10451045                        $args->rewrite['feeds'] = (bool) $args->has_archive;
    10461046                if ( ! isset( $args->rewrite['ep_mask'] ) ) {
    10471047                        if ( isset( $args->permalink_epmask ) )
     
    10551055                else
    10561056                        add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    10571057
     1058                $archive_slug = ( is_string( $args->has_archive ) && strlen( $args->has_archive ) ) ? $args->has_archive : $args->rewrite['slug'];
     1059                if ( $args->rewrite['with_front'] )
     1060                        $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
     1061                else
     1062                        $archive_slug = $wp_rewrite->root . $archive_slug;
     1063
     1064                if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
     1065                        $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
     1066                        add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     1067                        add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     1068                }
     1069
    10581070                if ( $args->has_archive ) {
    1059                         $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
    1060                         if ( $args->rewrite['with_front'] )
    1061                                 $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
    1062                         else
    1063                                 $archive_slug = $wp_rewrite->root . $archive_slug;
    1064 
    10651071                        add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
    1066                         if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
    1067                                 $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
    1068                                 add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    1069                                 add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    1070                         }
    10711072                        if ( $args->rewrite['pages'] )
    10721073                                add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
    10731074                }