Make WordPress Core

Ticket #19875: 19875.2.diff

File 19875.2.diff, 1.3 KB (added by duck_, 13 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();
    822                 $page_structure = $this->get_page_permastruct();
     816                // the extra .? at the beginning prevents clashes with other regular expressions in the rules array
     817                $this->add_rewrite_tag( '%pagename%', '(.?.+?)', 'pagename=' );
    823818
    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;
     819                return $this->generate_rewrite_rules( $this->get_page_permastruct(), EP_PAGES );
    828820        }
    829821
    830822        /**