WordPress.org

Make WordPress Core

Ticket #3614: enable_generic_page_rules.diff

File enable_generic_page_rules.diff, 874 bytes (added by ryan, 10 years ago)
  • wp-includes/rewrite.php

     
    969969                unset($this->feed_structure);
    970970                unset($this->comment_feed_structure);
    971971                $this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false;
     972
     973                // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
     974                $structure = ltrim($this->permalink_structure, '/');
     975                if ( 0 === strpos($structure, '%postname%') ||
     976                         0 === strpos($structure, '%category%') ||
     977                         0 === strpos($structure, '%tag%') ||
     978                         0 === strpos($structure, '%author%') )
     979                         $this->use_verbose_page_rules = true;
     980                else
     981                        $this->use_verbose_page_rules = false;
    972982        }
    973983
    974984        function set_permalink_structure($permalink_structure) {