WordPress.org

Make WordPress Core

Ticket #19876: 19876.diff

File 19876.diff, 3.9 KB (added by duck_, 6 years ago)
  • wp-includes/rewrite.php

     
    816816                // the extra .? at the beginning prevents clashes with other regular expressions in the rules array
    817817                $this->add_rewrite_tag( '%pagename%', '(.?.+?)', 'pagename=' );
    818818
    819                 return $this->generate_rewrite_rules( $this->get_page_permastruct(), EP_PAGES );
     819                return $this->generate_rewrite_rules( $this->get_page_permastruct(), EP_PAGES, false, true, false, false );
    820820        }
    821821
    822822        /**
     
    14891489                }
    14901490
    14911491                // Post
    1492                 $post_rewrite = $this->generate_rewrite_rules($this->permalink_structure, EP_PERMALINK);
    1493                 $post_rewrite = apply_filters('post_rewrite_rules', $post_rewrite);
     1492                $post_rewrite = $this->generate_rewrite_rules( $this->permalink_structure, EP_PERMALINK, false, true, false, false );
     1493                $post_rewrite = apply_filters( 'post_rewrite_rules', $post_rewrite );
    14941494
    14951495                // Date
    1496                 $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct(), EP_DATE);
    1497                 $date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite);
     1496                $date_rewrite = $this->generate_rewrite_rules( $this->get_date_permastruct(), EP_DATE );
     1497                $date_rewrite = apply_filters( 'date_rewrite_rules', $date_rewrite );
    14981498
    14991499                // Root
    1500                 $root_rewrite = $this->generate_rewrite_rules($this->root . '/', EP_ROOT);
    1501                 $root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite);
     1500                $root_rewrite = $this->generate_rewrite_rules( $this->root . '/', EP_ROOT );
     1501                $root_rewrite = apply_filters( 'root_rewrite_rules', $root_rewrite );
    15021502
    15031503                // Comments
    1504                 $comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, EP_COMMENTS, true, true, true, false);
    1505                 $comments_rewrite = apply_filters('comments_rewrite_rules', $comments_rewrite);
     1504                $comments_rewrite = $this->generate_rewrite_rules( $this->root . $this->comments_base, EP_COMMENTS, true, true, true, false );
     1505                $comments_rewrite = apply_filters( 'comments_rewrite_rules', $comments_rewrite );
    15061506
    15071507                // Search
    1508                 $search_structure = $this->get_search_permastruct();
    1509                 $search_rewrite = $this->generate_rewrite_rules($search_structure, EP_SEARCH);
    1510                 $search_rewrite = apply_filters('search_rewrite_rules', $search_rewrite);
     1508                $search_rewrite = $this->generate_rewrite_rules( $this->get_search_permastruct(), EP_SEARCH );
     1509                $search_rewrite = apply_filters( 'search_rewrite_rules', $search_rewrite );
    15111510
    15121511                // Authors
    1513                 $author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct(), EP_AUTHORS);
    1514                 $author_rewrite = apply_filters('author_rewrite_rules', $author_rewrite);
     1512                $author_rewrite = $this->generate_rewrite_rules( $this->get_author_permastruct(), EP_AUTHORS );
     1513                $author_rewrite = apply_filters( 'author_rewrite_rules', $author_rewrite );
    15151514
    15161515                // Pages
    15171516                $page_rewrite = $this->page_rewrite_rules();
    1518                 $page_rewrite = apply_filters('page_rewrite_rules', $page_rewrite);
     1517                $page_rewrite = apply_filters( 'page_rewrite_rules', $page_rewrite );
    15191518
    15201519                // Extra permastructs
    15211520                foreach ( $this->extra_permastructs as $permastructname => $permastruct ) {
    1522                         if ( is_array($permastruct) )
    1523                                 $rules = $this->generate_rewrite_rules($permastruct[0], $permastruct[1]);
     1521                        if ( is_array( $permastruct ) )
     1522                                $rules = $this->generate_rewrite_rules( $permastruct[0], $permastruct[1] );
    15241523                        else
    1525                                 $rules = $this->generate_rewrite_rules($permastruct, EP_NONE);
     1524                                $rules = $this->generate_rewrite_rules( $permastruct, EP_NONE );
    15261525
    1527                         $rules = apply_filters($permastructname . '_rewrite_rules', $rules);
     1526                        $rules = apply_filters( $permastructname . '_rewrite_rules', $rules );
    15281527                        if ( 'post_tag' == $permastructname )
    1529                                 $rules = apply_filters('tag_rewrite_rules', $rules);
     1528                                $rules = apply_filters( 'tag_rewrite_rules', $rules );
    15301529
    1531                         $this->extra_rules_top = array_merge($this->extra_rules_top, $rules);
     1530                        $this->extra_rules_top = array_merge( $this->extra_rules_top, $rules );
    15321531                }
    15331532
    15341533                // Put them together.