Make WordPress Core

Ticket #3964: fix_ep_root_rewrite.diff

File fix_ep_root_rewrite.diff, 1.2 KB (added by westi, 19 years ago)

Fix EP_ROOT by moving the endpoint code outside of the check for any sub directories.

  • wp-includes/rewrite.php

     
    582582                        if ($paged) //...and /page/xx ones
    583583                                $rewrite = array_merge($rewrite, array($pagematch => $pagequery));
    584584
     585                        //do endpoints
     586                        if ($endpoints) {
     587                                foreach ($ep_query_append as $regex => $ep) {
     588                                        //add the endpoints on if the mask fits
     589                                        if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) {
     590                                                $rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2);
     591                                        }
     592                                }
     593                        }
     594
    585595                        //if we've got some tags in this dir
    586596                        if ($num_toks) {
    587597                                $post = false;
     
    599609                                                $page = true;
    600610                                }
    601611
    602                                 //do endpoints
    603                                 if ($endpoints) {
    604                                         foreach ($ep_query_append as $regex => $ep) {
    605                                                 //add the endpoints on if the mask fits
    606                                                 if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) {
    607                                                         $rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2);
    608                                                 }
    609                                         }
    610                                 }
    611 
    612612                                //if we're creating rules for a permalink, do all the endpoints like attachments etc
    613613                                if ($post) {
    614614                                        $post = true;