Make WordPress Core

Ticket #21970: 21970.diff

File 21970.diff, 812 bytes (added by kovshenin, 12 years ago)

Check the page post status before verifying a match

  • wp-includes/class-wp.php

     
    206206
    207207                                                if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
    208208                                                        // this is a verbose page match, lets check to be sure about it
    209                                                         if ( ! get_page_by_path( $matches[ $varmatch[1] ] ) )
     209                                                        $page = get_page_by_path( $matches[ $varmatch[1] ] );
     210                                                        if ( ! $page )
    210211                                                                continue;
     212
     213                                                        $post_status_obj = get_post_status_object( $page->post_status );
     214                                                        if ( ! ( $post_status_obj->public || $post_status_obj->protected || $post_status_obj->private ) )
     215                                                                continue;
    211216                                                }
    212217
    213218                                                // Got a match.