show_admin_bar( bool $show )
Sets the display status of the admin bar.
Description Description
This can be called immediately upon plugin load. It does not need to be called from a function hooked to the ‘init’ action.
Parameters Parameters
- $show
-
(bool) (Required) Whether to allow the admin bar to show.
Source Source
File: wp-includes/admin-bar.php
function show_admin_bar( $show ) { global $show_admin_bar; $show_admin_bar = (bool) $show; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
Placing the below line of code in theme’s function.php file will prevent the Toolbar from rendering on the front end of your site.
Selected display
You can also determine for which users the admin bar is shown. For example the following lines will only display the admin bar for users with administrative privileges.
The proper method for hiding the Toolbar on the front-end (cannot be disabled on the back-end).