Making WordPress.org

Changeset 10782


Ignore:
Timestamp:
03/05/2021 12:51:09 AM (4 years ago)
Author:
coffee2code
Message:

Handbooks, Handbook: Prevent duplicate queries when trying to find handbook root page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/handbook.php

    r10781 r10782  
    526526            if ( ! $page ) {
    527527                $slug = str_replace( '-handbook', '', $this->post_type );
    528                 $page = get_page_by_path( $slug, OBJECT, $this->post_type );
    529             }
    530             if ( ! $page ) {
     528                if ( $slug !== $this->post_type ) {
     529                    $page = get_page_by_path( $slug, OBJECT, $this->post_type );
     530                }
     531            }
     532            if ( ! $page && 'handbook' !== $this->post_type ) {
    531533                $page = get_page_by_path( 'handbook', OBJECT, $this->post_type );
    532534            }
    533             if ( ! $page ) {
     535            if ( ! $page && 'welcome' !== $this->post_type ) {
    534536                $page = get_page_by_path( 'welcome', OBJECT, $this->post_type );
    535537            }
Note: See TracChangeset for help on using the changeset viewer.