WordPress.org

Make WordPress Core

Ticket #19875: 19875.diff

File 19875.diff, 1.3 KB (added by duck_, 4 years ago)
  • wp-includes/rewrite.php

     
    807807        /** 
    808808         * Retrieve all of the rewrite rules for pages. 
    809809         * 
    810          * If the 'use_verbose_page_rules' property is false, then there will only 
    811          * be a single rewrite rule for pages for those matching '%pagename%'. With 
    812          * the property set to true, the attachments and the pages will be added for 
    813          * each individual attachment URI and page URI, respectively. 
    814          * 
    815810         * @since 1.5.0 
    816811         * @access public 
    817812         * 
    818813         * @return array 
    819814         */ 
    820815        function page_rewrite_rules() { 
    821                 $rewrite_rules = array(); 
     816                // the extra .? at the beginning prevents clashes with other regular expressions in the rules array 
     817                $this->add_rewrite_tag( '%pagename%', '(.?.+?)', 'pagename=' ); 
     818 
    822819                $page_structure = $this->get_page_permastruct(); 
    823  
    824                 // the extra .? at the beginning prevents clashes with other regular expressions in the rules array 
    825                 $this->add_rewrite_tag('%pagename%', "(.?.+?)", 'pagename='); 
    826                 $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); 
    827                 return $rewrite_rules; 
     820                return $this->generate_rewrite_rules( $page_structure, EP_PAGES ); 
    828821        } 
    829822 
    830823        /**