Skip to:

Re: Converting Single WP site to BP and left with a few questions



switch_to_blog — when abused to get numerous queries from other blog/s, or get all widgets of the main site’s sidebar, or get sets of posts, etc — is going to be a “slow function” to run. But when used for main navigation which has what, 5 to 8 links, switch_to_blog runs in a split second wherever it is placed – I just prefer to place my main nav in header.php.

If one is wary of switch_to_blog “overhead” for navigation, then easiest method is to look at source code of main site’s navigation and copy the navigation links there and paste to sub-blogs theme’s header.php or wherever they want to place it. Caveat to this method is, you’ll miss the automatic generation of new links when new plugins/components hook to bp_nav_items. This won’t happen when you use switch_to_blog and add restore_current_blog after the bp_nav_items block.

Skip to toolbar