Make WordPress Core

Ticket #43746: 43746.2.diff

File 43746.2.diff, 1.5 KB (added by mattkeys, 5 years ago)
  • src/wp-includes/class-wp-post-type.php

    diff --git a/src/wp-includes/class-wp-post-type.php b/src/wp-includes/class-wp-post-type.php
    index ba37a02fb5..15cbafb069 100644
    a b final class WP_Post_Type { 
    486486                        if ( ! isset( $args['rewrite']['pages'] ) ) {
    487487                                $args['rewrite']['pages'] = true;
    488488                        }
    489                         if ( ! isset( $args['rewrite']['feeds'] ) || ! $args['has_archive'] ) {
     489                        if ( ! isset( $args['rewrite']['feeds'] ) ) {
    490490                                $args['rewrite']['feeds'] = (bool) $args['has_archive'];
    491491                        }
    492492                        if ( ! isset( $args['rewrite']['ep_mask'] ) ) {
    final class WP_Post_Type { 
    560560                                if ( $this->rewrite['pages'] ) {
    561561                                        add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$this->name" . '&paged=$matches[1]', 'top' );
    562562                                }
     563                        } else if ( $this->rewrite['feeds'] && $wp_rewrite->feeds ) {
     564                                $archive_slug = $this->rewrite['slug'];
     565                                if ( $this->rewrite['with_front'] ) {
     566                                        $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
     567                                } else {
     568                                        $archive_slug = $wp_rewrite->root . $archive_slug;
     569                                }
     570
     571                                $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
     572                                add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$this->name" . '&feed=$matches[1]', 'top' );
     573                                add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$this->name" . '&feed=$matches[1]', 'top' );
    563574                        }
    564575
    565576                        $permastruct_args         = $this->rewrite;