show_admin_bar
Filter HookDescription
Filters whether to show the admin bar. Returning false to this hook is the recommended way to hide the admin bar. The user's display preference is used for logged in users.Hook Information
File Location |
wp-includes/admin-bar.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1382 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$show_admin_bar
|
Whether the admin bar should be shown. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into show_admin_bar
add_filter('show_admin_bar', 'my_custom_filter', 10, 1);
function my_custom_filter($show_admin_bar) {
// Your custom filtering logic here
return $show_admin_bar;
}
Source Code Context
wp-includes/admin-bar.php:1382
- How this hook is used in WordPress core
<?php
1377 *
1378 * @since 3.1.0
1379 *
1380 * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
1381 */
1382 $show_admin_bar = apply_filters( 'show_admin_bar', $show_admin_bar );
1383
1384 return $show_admin_bar;
1385 }
1386
1387 /**
PHP Documentation
<?php
/**
* Filters whether to show the admin bar.
*
* Returning false to this hook is the recommended way to hide the admin bar.
* The user's display preference is used for logged in users.
*
* @since 3.1.0
*
* @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/admin-bar.php
Related Hooks
Related hooks will be displayed here in future updates.