Ticket #3885: 3885.diff
| File 3885.diff, 4.4 KB (added by mdawaffe, 5 years ago) |
|---|
-
wp-includes/query.php
561 561 $this->is_admin = true; 562 562 } 563 563 564 if ( $this->is_single || $this->is_page || $this->is_attachment )565 $this->is_singular = true;566 567 564 if ( false !== strpos($qv['feed'], 'comments-') ) { 568 565 $this->query_vars['feed'] = $qv['feed'] = str_replace('comments-', '', $qv['feed']); 569 566 $qv['withcomments'] = 1; … … 572 569 if ( $this->is_feed && (!empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) ) 573 570 $this->is_comment_feed = true; 574 571 575 if ( ! ($this->is_sing ular|| $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {572 if ( ! ($this->is_single || $this->is_page || $this->is_attachment || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) { 576 573 $this->is_home = true; 577 574 } 578 575 576 if ( $this->is_home && (empty($this->query) || $qv['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) { 577 $this->is_page = true; 578 $this->is_home = false; 579 $this->query_vars['page_id'] = get_option('page_on_front'); 580 } 581 582 if ( '' != $qv['pagename']) { 583 $this->queried_object =& get_page_by_path($qv['pagename']); 584 if ( !empty($this->queried_object) ) 585 $this->queried_object_id = $this->queried_object->ID; 586 else 587 unset($this->queried_object); 588 589 if ( ('page' == get_option('show_on_front') ) && ( isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts') ) ) { 590 $this->is_page = false; 591 $this->is_home = true; 592 $this->is_posts_page = true; 593 } 594 } 595 596 if (($qv['page_id'] != '') && (intval($qv['page_id']) != 0)) { 597 $this->query_vars['page_id'] = intval($qv['page_id']); 598 if ( ('page' == get_option('show_on_front') ) && ( $qv['page_id'] == get_option('page_for_posts') ) ) { 599 $this->is_page = false; 600 $this->is_home = true; 601 $this->is_posts_page = true; 602 } 603 } 604 605 if ( $this->is_single || $this->is_page || $this->is_attachment ) 606 $this->is_singular = true; 607 579 608 if ( !empty($query) ) { 580 609 do_action_ref_array('parse_query', array(&$this)); 581 610 } … … 724 753 $q['name'] = sanitize_title($q['name']); 725 754 $where .= " AND post_name = '" . $q['name'] . "'"; 726 755 } else if ('' != $q['pagename']) { 727 $reqpage = get_page_by_path($q['pagename']); 728 if ( !empty($reqpage) ) 729 $reqpage = $reqpage->ID; 730 else 731 $reqpage = 0; 756 if ( isset($this->queried_object_id) ) 757 $reqpage = $this->queried_object_id; 758 else { 759 $reqpage = get_page_by_path($q['pagename']); 760 if ( !empty($reqpage) ) 761 $reqpage = $reqpage->ID; 762 else 763 $reqpage = 0; 764 } 732 765 733 if ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) { 734 $this->is_singular = false; 735 $this->is_page = false; 736 $this->is_home = true; 737 $this->is_posts_page = true; 738 } else { 766 if ( ('page' != get_option('show_on_front') ) || ( $reqpage != get_option('page_for_posts') ) ) { 739 767 $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename']))); 740 768 $page_paths = '/' . trim($q['pagename'], '/'); 741 769 $q['pagename'] = sanitize_title(basename($page_paths)); … … 770 798 771 799 if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) { 772 800 $q['page_id'] = intval($q['page_id']); 773 if ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) { 774 $this->is_singular = false; 775 $this->is_page = false; 776 $this->is_home = true; 777 $this->is_posts_page = true; 778 } else { 801 if ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) { 779 802 $q['p'] = $q['page_id']; 780 803 $where = ' AND ID = '.$q['page_id']; 781 804 } … … 1003 1026 } 1004 1027 1005 1028 // Comments feeds 1029 if ( $this->is_posts_page && !$q['withcomments'] ) 1030 $this->is_comment_feed = false; 1031 1006 1032 if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) { 1007 1033 if ( $this->is_archive || $this->is_search ) { 1008 1034 $cjoin = "LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
