WordPress.org

Make WordPress Core

Ticket #43571: 43571.diff

File 43571.diff, 973 bytes (added by soulseekah, 20 months ago)
  • src/wp-includes/class-wp-rewrite.php

    diff --git a/src/wp-includes/class-wp-rewrite.php b/src/wp-includes/class-wp-rewrite.php
    index 337a811..82b9879 100644
    a b class WP_Rewrite { 
    858858         */
    859859        public function generate_rewrite_rules( $permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true ) {
    860860                // Build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/?
    861                 $feedregex2 = '';
    862                 foreach ( (array) $this->feeds as $feed_name ) {
    863                         $feedregex2 .= $feed_name . '|';
     861                $feedregex2 = array();
     862                foreach ( $this->feeds as $feed ) {
     863                        $feedregex2[] = preg_quote( $feed, '#' );
    864864                }
    865                 $feedregex2 = '(' . trim( $feedregex2, '|' ) . ')/?$';
     865                $feedregex2 = '(' . implode( '|', $feedregex2 ) . ')/?$';
    866866
    867867                /*
    868868                 * $feedregex is identical but with /feed/ added on as well, so URLs like <permalink>/feed/atom