WordPress.org

Make WordPress Core

Ticket #16415: 16415.diff

File 16415.diff, 2.1 KB (added by aaroncampbell, 7 years ago)
  • wp-includes/post.php

     
    972972                        $args->rewrite['with_front'] = true;
    973973                if ( ! isset( $args->rewrite['pages'] ) )
    974974                        $args->rewrite['pages'] = true;
    975                 if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive )
     975                if ( ! isset( $args->rewrite['feeds'] ) && isset( $args->has_archive ) )
    976976                        $args->rewrite['feeds'] = (bool) $args->has_archive;
    977977
    978978                if ( $args->hierarchical )
     
    980980                else
    981981                        $wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    982982
     983                $archive_slug = ( is_string( $args->has_archive ) && strlen( $args->has_archive ) ) ? $args->has_archive : $args->rewrite['slug'];
     984                if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
     985                        $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
     986                        $wp_rewrite->add_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     987                        $wp_rewrite->add_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     988                }
    983989                if ( $args->has_archive ) {
    984                         $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
    985990                        $wp_rewrite->add_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
    986                         if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
    987                                 $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
    988                                 $wp_rewrite->add_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    989                                 $wp_rewrite->add_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    990                         }
    991991                        if ( $args->rewrite['pages'] )
    992992                                $wp_rewrite->add_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
    993993                }
     
    52355235}
    52365236add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
    52375237
    5238 ?>
    5239  No newline at end of file
     5238?>