Created
March 4, 2025 18:30
-
-
Save vapvarun/85beaa5b6afe2ef99d7cef0623fe9974 to your computer and use it in GitHub Desktop.
Remove the "Reviews" tab from the Business Profile menu in BuddyPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Remove the "Reviews" tab from the Business Profile menu in BuddyPress. | |
| * | |
| * This function hooks into `bp_business_profile_single_menu_items` to | |
| * dynamically remove the "Reviews" tab while ensuring compatibility. | |
| * | |
| * @since 1.0.0 | |
| * @author Your Name | |
| */ | |
| add_filter( 'bp_business_profile_single_menu_items', 'custom_remove_business_reviews_tab', 10, 2 ); | |
| function custom_remove_business_reviews_tab( $items, $endpoints ) { | |
| // Ensure the required function exists to prevent errors | |
| if ( function_exists( 'bp_business_profile_get_business_slug' ) ) { | |
| // Get the dynamically generated reviews slug | |
| $reviews_slug = bp_business_profile_get_business_slug() . '-reviews'; | |
| // Check if the reviews tab exists and remove it | |
| if ( isset( $items[ $reviews_slug ] ) ) { | |
| unset( $items[ $reviews_slug ] ); | |
| } | |
| } | |
| return $items; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment