Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Created December 10, 2019 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/09216c16174e8dd3e3718b312f121ee7 to your computer and use it in GitHub Desktop.
Save KaineLabs/09216c16174e8dd3e3718b312f121ee7 to your computer and use it in GitHub Desktop.
Hide Widgets Settings By Profile Tab.
<?php
/**
* Hide Widgets Settings By Profile Tab.
*/
function yzc_hide_widgets_by_slug( $widgets ) {
// Get Tab Slug
$tab_slug = 'my-community';
if ( bp_current_component() == $tab_slug ) {
$widgets = array( array( 'widget_id' => 'visible' ) );
} else {
foreach ($widgets as $key => $value ) {
if ( $value == array( 'widget_id' => 'visible' ) ) {
unset( $widgets[ $key ] );
}
}
}
return $widgets;
}
add_filter( 'yz_profile_sidebar_widgets', 'yzc_hide_widgets_by_slug' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment