Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/24/2023 04:21:16 AM (10 months ago)
Author:
imath
Message:

Make sure slugs are customizable for the BP root site

On multisite configs the BP root site can be different than the current WordPress site. It's necessary to eventually switch to the BP root site before saving custom slugs or retrieving them.

Props perchenet

See #9048 (trunk)
Closes https://github.com/buddypress/buddypress/pull/206

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r13648 r13678  
    776776
    777777        // Set pages as standard class.
    778         $pages = new stdClass;
     778        $pages                 = new stdClass;
     779        $switched_to_root_blog = false;
     780
     781        // Make sure the current blog is set to the root blog.
     782        if ( ! bp_is_root_blog() && ! bp_is_multiblog_mode() ) {
     783            switch_to_blog( bp_get_root_blog_id() );
     784            $switched_to_root_blog = true;
     785        }
    779786
    780787        // Get pages and IDs.
     
    816823                }
    817824            }
     825        }
     826
     827        if ( $switched_to_root_blog ) {
     828            restore_current_blog();
    818829        }
    819830
Note: See TracChangeset for help on using the changeset viewer.