Skip to:
Content

BuddyPress.org

Changeset 13362


Ignore:
Timestamp:
11/09/2022 04:36:50 AM (3 years ago)
Author:
imath
Message:

Check a BuddyPress page exists before trying to access its properties

In bp_core_menu_highlight_parent_page() when trying to determine if the displayed page has a BuddyPress page ancestor, we need to make sure the potential BuddyPress page still exists to avoid a PHP notice/error.

Props dd32

Fixes #8760 (branch 10.0)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/10.0/src/bp-core/bp-core-filters.php

    r13333 r13362  
    200200    if ( ! empty( $page_id ) ) {
    201201        $_bp_page = get_post( $page_id );
    202         if ( in_array( $page->ID, $_bp_page->ancestors, true ) ) {
     202        if ( $_bp_page && in_array( $page->ID, $_bp_page->ancestors, true ) ) {
    203203            $retval[] = 'current_page_ancestor';
    204204        }
Note: See TracChangeset for help on using the changeset viewer.