Created
June 17, 2020 16:28
-
-
Save tobeyadr/a1fb8b25086dc15ceb0bf0cac07f309b to your computer and use it in GitHub Desktop.
Remove tabs from the tools page if the current user is not a super admin.
This file contains 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
<?php | |
/** | |
* Remove unwanted tabs from the tools page | |
* | |
* @param $tabs | |
* | |
* @return array[] | |
*/ | |
function remove_tools_tabs_from_groundhogg( $tabs ){ | |
// Remove tabs for non super admin... | |
if ( ! is_super_admin() ){ | |
// Filter out tabs which are not needed... | |
$tabs = array_filter( $tabs, function ( $tab ){ | |
$tabs_to_remove = [ '', '' ]; // Todo provide the tab slugs... | |
return ! in_array( $tab[ 'slug' ], $tabs_to_remove ); | |
} ); | |
} | |
return $tabs; | |
} | |
add_filter( 'groundhogg/admin/tools/tabs', 'remove_tools_tabs_from_groundhogg', 99, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment