Changing the WordPress Admin Bar Icon lets you replace the small site icon displayed beside the website name in the WordPress administration Toolbar without changing the rest of the Toolbar or the public website.
This can be useful for:
- client branding;
- agency-managed WordPress installations;
- distinguishing staging from production;
- making different WordPress sites easier to recognize;
- creating a more consistent backend identity.
The important first step is understanding exactly which icon you are changing.
WordPress can display several different small visual elements around the administration interface:
WordPress logo
→ far-left Toolbar menu
Site-name icon
→ beside the current site name
Admin favicon
→ browser tab
Admin Menu Logo
→ left wp-admin sidebar
These are different elements controlled by different parts of WordPress.
This guide focuses specifically on the site-name icon inside the WordPress Toolbar.
It explains how the current WordPress Toolbar works, how the Site Icon is used there, how to replace the icon programmatically, how to limit the change to wp-admin, how image dimensions affect rendering, how to avoid breaking the Toolbar and how TheOneWP Admin Bar Icon handles the same customization through the WordPress Media Library.
What is the WordPress Admin Bar?
The interface commonly called the:
Admin Bar
is officially referred to by WordPress as the:
Toolbar
The Core WP_Admin_Bar documentation describes it as the class responsible for generating the Toolbar shown across the top of WordPress when applicable.
WordPress has used the term Toolbar since WordPress 3.3, although:
Admin Bar
remains widely used in tutorials, plugins and everyday conversation.
The Toolbar is generated from nodes
Individual Toolbar items are represented internally as:
nodes
Examples include:
wp-logo
site-name
comments
new-content
my-account
The WP_Admin_Bar class provides methods for retrieving, adding, changing and removing those nodes.
The icon beside the site name belongs to the site-name node
The relevant Toolbar node is:
site-name
WordPress creates it through:
wp_admin_bar_site_menu()
The official wp_admin_bar_site_menu() documentation shows how WordPress builds the site-name Toolbar item.
Modern WordPress can use the Site Icon in the Toolbar
Current WordPress Core checks whether the site has a configured:
Site Icon
When one exists, Core can retrieve:
32 × 32 source
64 × 64 source for high-density displays
and render the Toolbar image at:
20 × 20 pixels
The generated markup uses the site-icon class
Conceptually, the generated title can contain:
<img
class="site-icon"
src="..."
alt=""
width="20"
height="20"
/>
Site Name
This is important because many older tutorials describe the site-name icon exclusively as a Dashicon or home symbol.
Modern WordPress can instead display the configured Site Icon directly.
WordPress also loads a 2x image when available
Core can use:
32 px
→ normal source
64 px
→ 2x source
through an image srcset.
The browser still displays the icon at:
20 × 20 CSS pixels
but a higher-resolution source can improve rendering on high-density screens.
The WordPress logo on the far left is different
Do not confuse:
site-name
with:
wp-logo
The WordPress logo menu is created by:
wp_admin_bar_wp_menu()
The official wp_admin_bar_wp_menu() documentation shows that this is a separate Toolbar node.
The two areas have different purposes
wp-logo
→ About WordPress menu
→ WordPress identity
site-name
→ current website
→ site navigation
→ site identity
TheOneWP Admin Bar Icon targets the icon associated with:
site-name
not the separate:
wp-logo
menu.
Why change the WordPress Admin Bar Icon?
The default behavior is perfectly functional.
There are still several situations where a custom icon can improve the administration experience.
1. Client branding
An agency-managed backend can display the client’s visual identity beside the site name.
This creates a subtle branded element without rebuilding the entire Toolbar.
2. Faster site identification
Administrators often work with several WordPress sites simultaneously.
For example:
Client A wp-admin
Client B wp-admin
Client C wp-admin
Company website wp-admin
Distinct icons make the current installation easier to identify visually.
3. Staging vs production
A useful environment convention could be:
Production
→ normal brand icon
Staging
→ orange variant
Development
→ blue development icon
This can provide an additional visual warning before an administrator performs an action on the wrong environment.
4. Consistent backend identity
The Admin Bar Icon can be combined with:
- admin favicon;
- Admin Menu Logo;
- custom admin colors;
- custom login page;
- footer branding.
See How to Brand the WordPress Admin Dashboard for the wider backend-branding strategy.
Method 1: change the WordPress Site Icon
If you are happy for the same icon to represent the public site and the Toolbar, the simplest solution may be to change the normal WordPress:
Site Icon
Current Core can automatically use that icon inside the site-name Toolbar node.
This is the easiest option when one identity is enough
The resulting relationship is:
Site Icon
↓
frontend identity
+
browser favicon behavior
+
Toolbar site-name icon
This requires no separate Toolbar-specific customization.
But it is not admin-specific
If the requirement is:
Public Site Icon
→ Brand A
wp-admin Toolbar icon
→ Brand B
changing the Site Icon is the wrong level of customization.
You need to replace only the Toolbar representation instead.
Method 2: change the site-name node with admin_bar_menu
The normal WordPress API for changing Toolbar nodes is:
admin_bar_menu
The official admin_bar_menu documentation states that the hook can:
- add Toolbar items;
- remove Toolbar items;
- modify Toolbar items.
The site-name node is registered at priority 30
WordPress Core registers:
wp_admin_bar_site_menu
on:
admin_bar_menu
at priority:
30
Therefore, if you want to modify the completed:
site-name
node, your callback should execute later.
A common choice is:
999
Basic administration-only example
function project_change_admin_bar_icon(
WP_Admin_Bar $wp_admin_bar
) {
if ( ! is_admin() ) {
return;
}
if (
is_network_admin()
||
is_user_admin()
) {
return;
}
$node =
$wp_admin_bar->get_node(
'site-name'
);
if ( ! $node ) {
return;
}
$icon_url =
plugin_dir_url( __FILE__ )
. 'assets/admin-bar-icon.png';
$site_name =
wp_strip_all_tags(
get_bloginfo( 'name' )
);
if ( '' === $site_name ) {
$site_name =
(string) wp_parse_url(
home_url( '/' ),
PHP_URL_HOST
);
}
$meta =
is_array( $node->meta )
? $node->meta
: array();
$existing_class =
isset( $meta['class'] )
? $meta['class']
: '';
$meta['class'] =
trim(
$existing_class
. ' has-site-icon'
);
$title = sprintf(
'<img class="site-icon" src="%1$s" alt="" width="20" height="20" />%2$s',
esc_url( $icon_url ),
esc_html( $site_name )
);
$wp_admin_bar->add_node(
array(
'id' => 'site-name',
'title' => $title,
'meta' => $meta,
)
);
}
add_action(
'admin_bar_menu',
'project_change_admin_bar_icon',
999
);
What this code does
The sequence is:
Toolbar begins loading
↓
WordPress registers site-name
↓
Core adds Site Icon if available
↓
our callback runs at 999
↓
site-name node retrieved
↓
custom image replaces title icon
↓
original destination preserved
Why get_node() is useful
WordPress provides:
WP_Admin_Bar::get_node()
to retrieve an existing Toolbar node.
The official get_node() documentation explains that it returns the object representing the requested Toolbar item.
This lets you inspect the existing:
- ID;
- title;
- href;
- parent;
- metadata.
before changing it.
Why use add_node() again?
The add_node() method is also used to update an existing node.
That means you do not need to:
remove site-name
↓
recreate every property manually
when only part of the node needs changing.
Why check is_admin()?
The WordPress Toolbar can appear in two different contexts:
wp-admin
and
frontend for logged-in users
If you run the modification without checking:
is_admin()
the custom icon can also appear in the Toolbar on the public website.
Administration-only branding
This:
if ( ! is_admin() ) {
return;
}
means:
wp-admin
→ custom icon
frontend Toolbar
→ normal WordPress behavior
Remove that condition if you want both contexts
If the custom icon should appear everywhere the logged-in Toolbar is rendered, remove the administration-only condition deliberately.
The Toolbar is always integrated into wp-admin
The official is_admin_bar_showing() implementation treats the administration interface differently from the frontend.
On the frontend, Toolbar display also depends on:
- whether the user is logged in;
- the user’s display preference;
- the
show_admin_barfilter.
Method 3: use a Media Library attachment
If the image should be managed through WordPress rather than stored inside a plugin directory, use an attachment.
For example:
$attachment_id = 123;
$icon_url =
wp_get_attachment_url(
$attachment_id
);
if ( ! $icon_url ) {
return;
}
The official wp_get_attachment_url() documentation covers retrieving the file URL associated with a Media Library attachment.
Media Library workflow
Upload square icon
↓
select image
↓
store attachment ID
↓
resolve URL
↓
escape URL
↓
use in Toolbar
This is easier for non-developers than replacing a file inside plugin code.
Sanitize saved URLs
If a settings interface stores the final image URL directly, sanitize it before storage.
For example:
$icon_url =
esc_url_raw(
$_POST['admin_bar_icon_url']
);
Then escape it again when outputting it:
esc_url( $icon_url )
The normal pattern is:
storage
→ esc_url_raw()
HTML / CSS output
→ esc_url()
Do not trust an arbitrary image URL
A branding setting should still use:
- capability checks;
- nonces;
- input sanitization;
- output escaping.
The fact that the value represents a tiny icon does not remove normal WordPress security requirements.
How large should the Admin Bar Icon be?
The visible Toolbar slot is:
20 × 20 pixels
in current WordPress’s site-name icon implementation.
That does not necessarily mean the source image itself should be exactly 20×20.
Use a higher-resolution source
A practical source could be:
40 × 40
64 × 64
80 × 80
while still displaying at:
20 × 20
This can improve sharpness on high-density displays.
TheOneWP recommends at least 40×40
The current Admin Bar Icon interface recommends a:
square PNG or SVG
at least 40 × 40 pixels
while preserving the native:
20 × 20
display area.
The source should be square
Use:
1:1 aspect ratio
such as:
40 × 40
64 × 64
128 × 128
rather than:
180 × 40
A horizontal logo is usually a poor choice
The icon slot is too small for:
- company names;
- taglines;
- detailed horizontal logos;
- thin typography.
Use:
- a brand symbol;
- monogram;
- simple geometric logo;
- recognizable compact mark.
See Best Image Size for WordPress Admin Icons for the broader asset-preparation guide.
PNG vs SVG
Both can work well when used correctly.
PNG
PNG offers:
- strong compatibility;
- transparent backgrounds;
- simple Media Library handling;
- predictable rendering.
A:
40×40
or
64×64 PNG
is a straightforward option.
SVG
SVG can remain sharp at any pixel density.
However, WordPress Core does not permit unrestricted SVG uploads by default.
If SVG uploads are enabled, use an appropriate sanitization system rather than allowing arbitrary SVG content.
Do not weaken upload security for one icon
If secure SVG support is not already available, PNG is usually simpler.
Use transparency carefully
The WordPress Toolbar normally uses a dark background.
An icon composed entirely of:
dark grey
or
black
may become difficult to see.
Check contrast against the Toolbar
The icon should remain recognizable against:
- the default Toolbar background;
- custom admin color schemes;
- hover states;
- different browser rendering environments.
Do not rely on fine details
At:
20 × 20 pixels
small internal details disappear quickly.
A strong silhouette is usually more important than preserving every element of the full brand logo.
WordPress Site Icon vs Admin Bar Icon
These may use the same source image, but they solve different problems.
Site Icon
→ site-wide identity
Admin Bar Icon
→ Toolbar identity
Current Core can connect the two
If a Site Icon exists, WordPress can automatically display it inside the site-name Toolbar node.
Therefore, on a standard installation:
change Site Icon
↓
Toolbar icon may change too
A dedicated Admin Bar Icon breaks that dependency intentionally
This lets you configure:
Site Icon
→ public brand mark
Admin Bar Icon
→ alternate backend mark
Why would you want separate icons?
Examples include:
- staging indicator;
- agency support identity;
- internal company symbol;
- simplified version of a complex Site Icon;
- different branding for backend users.
Do not confuse Admin Bar Icon with Admin Favicon
The:
Admin Bar Icon
appears inside the WordPress Toolbar.
The:
Admin Favicon
appears in the browser interface.
They occupy completely different locations.
Browser tab
→ Admin Favicon
WordPress Toolbar
→ Admin Bar Icon
See How to Change the WordPress Admin Favicon.
TheOneWP Admin Favicon handles that separate browser-tab layer.
Do not confuse Admin Bar Icon with Admin Menu Logo
The Admin Menu Logo belongs to the left administration sidebar.
Toolbar
→ Admin Bar Icon
Left sidebar
→ Admin Menu Logo
See How to Add a Custom Logo to the WordPress Admin Menu.
TheOneWP Admin Menu Logo handles that separate visual location.
Do not confuse the site-name icon with the WordPress logo
This distinction is especially important.
The far-left WordPress symbol belongs to:
wp-logo
The icon beside the site’s name belongs to:
site-name
A customization designed for one should not accidentally replace the other.
Finding Toolbar node IDs
The official get_node() documentation explains a simple way to identify Toolbar nodes from HTML.
A rendered Toolbar element can have an ID such as:
wp-admin-bar-site-name
The corresponding node ID is:
site-name
Likewise:
wp-admin-bar-wp-logo
corresponds to:
wp-logo
Inspect the Toolbar with browser developer tools
Open:
Developer Tools
→ Elements
→ #wpadminbar
and inspect the rendered structure.
This is useful when:
- a plugin has modified the Toolbar;
- the expected icon is missing;
- multiple customizations conflict;
- a custom node ID is unknown.
Changing the icon with CSS instead of the node API
A second approach is to leave the existing Toolbar node intact and change only its visual icon through CSS.
The conceptual structure is:
existing site-name node
↓
hide native site-icon image
↓
display custom background image
↓
keep original text and link
Why CSS can be useful
It avoids reconstructing the Toolbar title.
The existing:
- site name;
- URL;
- submenu;
- accessibility metadata;
- Toolbar node structure;
can remain untouched.
Example administration-only CSS output
function project_admin_bar_icon_css() {
$icon_url =
plugin_dir_url( __FILE__ )
. 'assets/admin-bar-icon.png';
if ( ! $icon_url ) {
return;
}
?>
<style>
#wpadminbar
#wp-admin-bar-site-name
> .ab-item
.site-icon {
display: none;
}
#wpadminbar
#wp-admin-bar-site-name
> .ab-item::before {
content: "";
display: inline-block;
width: 20px;
height: 20px;
margin-right: 6px;
vertical-align: middle;
background-image:
url("<?php
echo esc_url(
$icon_url
);
?>");
background-position:
center;
background-repeat:
no-repeat;
background-size:
contain;
}
</style>
<?php
}
add_action(
'admin_head',
'project_admin_bar_icon_css'
);
CSS implementations must be tested against Core markup
A CSS selector depends on the generated HTML structure.
WordPress can evolve that structure over time.
Therefore, after significant WordPress updates, verify:
- the selector still matches;
- the native icon is still hidden;
- the custom icon remains aligned;
- mobile Toolbar behavior still works.
The node API is more structural
The:
admin_bar_menu
+
WP_Admin_Bar
approach works at the Toolbar data level.
The CSS approach works at the final presentation layer.
Both can be valid depending on what is being changed.
TheOneWP uses a focused visual replacement
The current TheOneWP Admin Bar Icon implementation applies replacement CSS inside:
admin_head
rather than rebuilding the complete Toolbar node.
The module targets the site-name icon only
It does not replace:
wp-logo
on the far left.
It targets the icon associated with:
site-name
TheOneWP hides an existing Site Icon image
If WordPress has already inserted:
<img class="site-icon">
inside the site-name Toolbar item, the module hides that image before applying its custom icon.
This prevents:
native Site Icon
+
custom Admin Bar Icon
from appearing together.
The custom image is used as a CSS background
The configured asset is displayed using a background-image approach with:
background-size: contain
This preserves the source aspect ratio inside the fixed icon area.
The rendered icon remains 20×20
The module preserves:
width: 20px
height: 20px
so replacing the icon does not expand the normal Toolbar height.
The module does not resize the source file
If you select:
500 × 500 PNG
the source file itself is not converted into a new 20×20 image.
It is displayed inside a 20×20 CSS area.
Prepare an optimized source anyway
There is little benefit in serving a multi-megabyte 3000×3000 image for a 20-pixel interface element.
A well-prepared source can be:
40×40
64×64
80×80
depending on the format and asset design.
TheOneWP uses the Media Library
The configuration workflow is:
Enable Admin Bar Icon
↓
open Media Library
↓
select custom image
↓
save settings
↓
reload wp-admin
↓
custom icon appears
No image means no custom output
If no valid image is selected, the module does not add its replacement CSS.
This allows normal WordPress behavior to continue.
The URL is sanitized and escaped
The saved URL is sanitized using:
esc_url_raw()
and escaped on output using:
esc_url()
This follows the normal WordPress distinction between:
stored URL
and
displayed URL
TheOneWP applies the change only inside wp-admin
The verified implementation outputs the replacement styling through:
admin_head
so the custom icon applies inside the administration interface.
The frontend Toolbar remains a separate context.
This distinction matters
An administrator can therefore use:
Frontend Toolbar
→ normal Site Icon
wp-admin Toolbar
→ custom Admin Bar Icon
without changing the public website identity.
The settings interface includes a live preview
The current module can update the icon preview while an image is selected so administrators can inspect the result before leaving the configuration interface.
Test the final wp-admin output anyway
A settings preview cannot reproduce every possible:
- admin color scheme;
- plugin Toolbar customization;
- responsive state;
- browser rendering difference.
Always test the actual WordPress Toolbar after saving.
Admin Bar Icon and responsive behavior
The WordPress Toolbar changes at narrower viewport widths.
On mobile administration screens:
- some labels may disappear;
- icons become more important;
- available horizontal space decreases;
- Toolbar items can be hidden or rearranged.
A custom icon should not change Toolbar height
Keeping the rendered icon at:
20 × 20
helps preserve the existing desktop layout.
Custom CSS should avoid introducing:
40px padding
50px icon
extra vertical margins
that force the Toolbar to change dimensions unexpectedly.
Test on mobile wp-admin
After changing the icon, test at least:
desktop
tablet
mobile
and verify:
- icon alignment;
- Toolbar height;
- site-name visibility;
- submenu behavior;
- touch interaction.
Admin Bar Icon and admin color schemes
WordPress administration colors can alter:
- Toolbar background;
- menu colors;
- hover states;
- active states.
A dark icon that works on one scheme may disappear on another.
Use an icon with enough contrast
For example, a transparent image containing only:
#1d2327
may be difficult to see against a similarly dark Toolbar.
Test against every supported admin scheme
This is especially important when users can select their own WordPress administration color scheme.
If your project forces one consistent backend palette, test against that final palette instead.
TheOneWP Custom Admin Color Scheme addresses that separate branding layer.
Admin Bar Icon and accessibility
If the icon is purely decorative and the site name remains visible, the image normally does not need meaningful alternative text.
That matches Core’s own behavior, where the Site Icon image in the Toolbar uses:
alt=""
and the visible site title provides the actual navigation label.
Do not replace the site name with an unlabeled icon
A Toolbar entry consisting only of:
custom logo
without an accessible name can make navigation less understandable.
Preserve:
- visible text where appropriate;
- the existing site-name label;
- accessible menu naming.
Do not use background images to communicate essential information
The icon should reinforce identity.
It should not be the only indicator of:
- site name;
- environment;
- critical status;
- permission level.
Use text for staging and production labels too
For example:
orange icon
+
STAGING
is stronger than relying on:
orange icon only
Admin Bar Icon and Multisite
WordPress Multisite adds additional Toolbar complexity.
Users may see:
- My Sites;
- Network Admin;
- individual site names;
- site icons for several sites.
WordPress can display icons in My Sites too
The:
wp_admin_bar_show_site_icons
filter also affects site icons used by Toolbar site lists.
The official wp_admin_bar_show_site_icons documentation states that:
true
→ site icons can be shown
false
→ hide site icons
The filter defaults to true
WordPress also notes that loading many site icons can have performance implications on very large Multisite networks.
Do not globally disable Site Icons merely to replace one site-name icon
This:
add_filter(
'wp_admin_bar_show_site_icons',
'__return_false'
);
affects the broader Toolbar Site Icon system.
If the goal is only:
replace this site's admin icon
a more targeted implementation is preferable.
Network Admin should be considered separately
The:
site-name
node behaves differently in:
- Site Admin;
- Network Admin;
- User Admin.
If the custom branding is intended only for normal site administration, explicitly exclude the other contexts.
That is why the earlier example includes:
if (
is_network_admin()
||
is_user_admin()
) {
return;
}
Changing the WordPress logo instead is a different customization
If the actual target is the:
WordPress W icon
on the far left, do not modify:
site-name
The relevant node is:
wp-logo
The wp-logo menu contains functionality
It is not merely an image.
It can contain links related to:
- About WordPress;
- WordPress.org;
- contribution;
- documentation or project information depending on Core version.
Replacing the visual icon and removing the complete menu are different operations.
Do not remove the complete node simply to change its icon
This:
$wp_admin_bar->remove_node(
'wp-logo'
);
removes the Toolbar node and its children.
That is not necessary if the only requirement is visual branding.
Removing Toolbar items is a separate task
For intentional Toolbar cleanup, see How to Remove Items from the WordPress Admin Bar.
Do not use JavaScript if PHP or CSS is sufficient
A common workaround is:
DOMContentLoaded
↓
find Toolbar icon
↓
replace DOM element
This is usually unnecessary.
Potential problems include:
- visible flash before replacement;
- dependency on JavaScript;
- fragile selectors;
- unnecessary client-side work.
Prefer server-generated Toolbar data or administration CSS.
Do not modify WordPress Core
Never edit:
wp-includes/admin-bar.php
to replace the icon.
Core updates can overwrite the modification.
WordPress already provides the:
admin_bar_menu
hook specifically for Toolbar customization.
Do not edit Core Toolbar CSS either
Changes inside WordPress Core stylesheets can disappear after updates.
Custom Toolbar styling should live in:
- a plugin;
- a site-specific plugin;
- a must-use plugin;
- a maintained admin customization module.
A theme is not always the best location
Ask:
Should switching
the frontend theme
remove the custom
admin Toolbar icon?
If the answer is no, the functionality probably belongs outside the theme.
Use admin_head carefully
For small amounts of administration-only CSS, using:
admin_head
can be reasonable.
For larger stylesheets, WordPress provides:
admin_enqueue_scripts
The official admin_enqueue_scripts documentation identifies it as the correct hook for administration scripts and styles.
Use a stylesheet for larger branding systems
If your custom backend also changes:
- Toolbar colors;
- menu colors;
- menu dimensions;
- typography;
- Dashboard components;
enqueue a maintainable stylesheet instead of printing a large CSS block in admin_head.
Admin Bar Icon troubleshooting
If the custom icon does not appear, troubleshoot systematically.
1. Verify the Toolbar is present
Check that:
#wpadminbar
exists in the rendered HTML.
2. Verify the site-name node exists
Inspect:
#wp-admin-bar-site-name
3. Verify your callback runs after Core
When modifying an existing node, use a priority after:
30
because Core creates the site-name item at priority 30.
A common choice is:
999
4. Check the image URL
Open the custom image directly in the browser.
Confirm it returns:
- the expected image;
- HTTP success;
- the correct file;
- no authentication page;
- no 404.
5. Inspect generated markup
If using the node method, inspect the site-name item for:
<img class="site-icon">
6. Inspect CSS
If using a background-image approach, verify that:
background-image
contains the expected URL.
7. Check competing plugins
Another plugin may modify:
site-name
at a later priority.
If your callback runs at:
100
and another customization runs at:
999
the later callback may override yours.
8. Check CSS specificity
A custom rule may be overridden by:
- Core Toolbar CSS;
- admin color scheme CSS;
- another branding plugin;
- a site-specific admin stylesheet.
9. Check caching
If you replace an image while keeping exactly the same URL:
admin-bar-icon.png
the browser or CDN may continue displaying an older version.
Use a new filename during diagnosis
For example:
admin-bar-icon-v2.png
can help distinguish:
wrong CSS
from
cached image
Check browser developer tools
Inspect:
Network
→ image request
and review:
- URL;
- HTTP status;
- Content-Type;
- cache status;
- resource dimensions.
Check whether the Site Icon is still visible
If you see two icons:
Site Icon
+
custom icon
the native:
.site-icon
image has not been hidden or replaced correctly.
Check whether the icon disappeared completely
Possible causes include:
- empty saved URL;
- invalid Media Library attachment;
- CSS rule hiding both old and new icon;
- background image blocked;
- incorrect selector;
- transparent icon with no visible contrast.
Check HTTPS
If wp-admin uses:
https://
but the image is loaded from:
http://
browser security policies may interfere.
Use HTTPS resources on HTTPS administration screens.
Check migrations
A stored absolute image URL can still point to:
staging.example.com
after the site moves to:
example.com
Verify stored URLs after:
- domain changes;
- staging-to-production deployment;
- HTTP-to-HTTPS migration;
- CDN changes.
Check Media Library file availability
If the selected attachment has been:
- deleted;
- moved by an offload plugin;
- blocked by permissions;
- rewritten incorrectly by a CDN;
the Toolbar cannot display it normally.
Do not use a huge file
The visible icon is:
20 × 20 pixels
An asset weighing several megabytes provides no useful visual advantage.
Admin Bar Icon performance
A properly optimized custom icon has negligible performance impact.
The browser only needs:
small administration CSS
+
small image resource
Do not add JavaScript frameworks or large branding bundles for this single interface element.
Cache the image normally
A stable icon can use normal browser caching.
The main time cache invalidation matters is when you intentionally replace the source while preserving the same URL.
Environment-specific icons
Developers can select different URLs according to the current environment.
Conceptually:
production
→ brand-icon.png
staging
→ staging-icon.png
development
→ dev-icon.png
Do not rely on the icon as the only environment indicator
Also consider:
- visible STAGING label;
- different admin color;
- Toolbar environment text;
- restricted deployment permissions.
Agency backend example
A complete agency-managed administration identity might use:
Browser tab
→ custom Admin Favicon
Toolbar
→ client Admin Bar Icon
Sidebar
→ client Admin Menu Logo
Footer
→ agency support link
This gives each branding surface a clear responsibility.
Keep the interface restrained
The Toolbar is primarily navigation.
The icon should help users identify the site without:
- increasing Toolbar height;
- pushing other controls away;
- adding animation;
- introducing unreadable text;
- becoming a promotional banner.
Use the icon as identity, not decoration
The most effective icon is usually:
small
clear
recognizable
consistent
rather than visually complex.
Common mistake: changing the wrong icon
Before writing code, identify whether you mean:
WordPress W icon
site-name icon
browser favicon
sidebar logo
Common mistake: replacing wp-logo instead of site-name
The WordPress logo menu and site-name node are independent.
Common mistake: changing the Site Icon unintentionally
If the public Site Icon should remain unchanged, use an admin-specific implementation.
Common mistake: forgetting the frontend Toolbar
admin_bar_menu is not restricted to wp-admin by itself.
Use:
is_admin()
when the custom icon should apply only inside the backend.
Common mistake: running too early
The Core:
site-name
node is added at priority:
30
so code that attempts to modify it earlier may not find it yet.
Common mistake: removing and rebuilding the entire Toolbar
Change only the element you need.
Common mistake: removing the complete site-name node
The site-name item also provides useful navigation.
Replacing the icon does not require removing that functionality.
Common mistake: using an enormous image
Prepare a small, optimized source appropriate for a 20×20 display area.
Common mistake: using a horizontal logo
Use a compact square mark instead.
Common mistake: ignoring transparent-icon contrast
Test the icon against the actual Toolbar background.
Common mistake: modifying Core files
Use WordPress hooks and APIs.
Common mistake: editing plugin files
Third-party plugin updates can overwrite those modifications.
Common mistake: using display:none to hide the entire Toolbar item
If the objective is only icon replacement, preserve the site-name functionality.
Common mistake: adding meaningful alt text to a decorative duplicate
The visible site name already identifies the destination.
An icon beside it is normally decorative.
Common mistake: removing the site name entirely
An icon alone can make navigation less understandable and less accessible.
Common mistake: forgetting mobile wp-admin
Toolbar behavior changes substantially at narrow viewport widths.
Common mistake: replacing the source file and blaming PHP when the browser shows the old icon
Inspect the actual image request and caching headers.
Common mistake: using several branding plugins for the same Toolbar element
Keep one clear owner for:
site-name icon
Common mistake: assuming every Site Icon change requires custom code
Modern WordPress already supports displaying the Site Icon in the site-name Toolbar item.
Custom code is only necessary when you need behavior different from the Core Site Icon relationship.
How to change the Admin Bar Icon with TheOneWP
The workflow is:
1. Enable Admin Bar Icon.
2. Open the module settings.
3. Choose an image
from the Media Library.
4. Prefer a square PNG
or sanitized SVG.
5. Use at least
approximately 40×40 pixels.
6. Save the settings.
7. Reload wp-admin.
8. Verify the icon
beside the site name.
What TheOneWP changes
The module changes:
site-name Toolbar icon
It does not change:
WordPress wp-logo menu
Admin Favicon
Admin Menu Logo
public Site Icon
The final rendering remains compact
The source image is fitted into:
20 × 20 pixels
using contained background-image rendering.
The existing Site Icon image is hidden
This prevents duplicate visual output when WordPress has already inserted its normal:
.site-icon
image.
The source image remains untouched
The module does not:
- crop the source;
- resize the source file;
- convert its format;
- generate a dedicated 20×20 image.
Prepare the image correctly before selecting it.
The change is limited to WordPress administration
This makes the module useful when the frontend Toolbar should continue using normal WordPress behavior.
Admin Bar Icon deployment checklist
- Confirm that the target is the site-name icon.
- Do not confuse it with the WordPress logo menu.
- Do not confuse it with the browser favicon.
- Do not confuse it with the Admin Menu Logo.
- Check whether a Site Icon already exists.
- Decide whether the Site Icon should remain unchanged.
- Use
admin_bar_menufor structural Toolbar modifications. - Modify existing nodes after Core has registered them.
- Use a priority later than the Core site-name registration.
- Use
get_node( 'site-name' )when modifying the current node. - Use
add_node()to update Toolbar node properties. - Use
is_admin()for administration-only behavior. - Consider Network Admin separately.
- Consider User Admin separately.
- Prepare a square source image.
- Design for a 20×20 display size.
- Use a higher-resolution source for sharp rendering.
- Optimize the source file.
- Prefer a simple symbol over a horizontal logo.
- Test transparent images against the Toolbar background.
- Test custom admin color schemes.
- Preserve the visible site name.
- Preserve Toolbar accessibility.
- Keep decorative icons decorative.
- Sanitize saved URLs with
esc_url_raw(). - Escape output URLs with
esc_url(). - Use Media Library attachments when appropriate.
- Check the image URL directly.
- Inspect
#wpadminbarin DevTools. - Inspect
#wp-admin-bar-site-name. - Check for competing Toolbar plugins.
- Check callback priority.
- Check CSS specificity.
- Check browser cache.
- Check CDN cache.
- Check HTTPS.
- Check absolute URLs after migrations.
- Test desktop wp-admin.
- Test tablet wp-admin.
- Test mobile wp-admin.
- Test Multisite where applicable.
- Do not edit WordPress Core.
- Do not edit third-party plugin files.
- Keep the customization in a maintained plugin or module layer.
Related guides
- Best Image Size for WordPress Admin Icons
- How to Change the WordPress Admin Favicon
- How to Add a Custom Logo to the WordPress Admin Menu
- How to Remove Items from the WordPress Admin Bar
- How to Brand the WordPress Admin Dashboard
- Standardizing the WordPress Admin for Teams
Final recommendation
Changing the WordPress Admin Bar Icon is a small customization, but it is worth targeting the correct Toolbar element rather than replacing unrelated parts of wp-admin.
Remember the basic structure:
wp-logo
→ WordPress logo menu
site-name
→ current website
→ target for Admin Bar Icon
Admin Favicon
→ browser tab
Admin Menu Logo
→ sidebar
Modern WordPress can already display the normal Site Icon beside the site name, using higher-resolution icon sources while rendering the result at approximately 20×20 pixels.
If the Site Icon is also the correct Toolbar identity, no separate customization may be necessary.
If the backend should use a different icon, modify only the:
site-name
Toolbar item.
For a custom implementation, use:
admin_bar_menu
+
WP_Admin_Bar
+
get_node()
+
add_node()
when changing the Toolbar structure itself.
Alternatively, use administration-only CSS when the objective is purely visual and preserving the existing node markup is preferable.
Keep the icon compact, square and recognizable at 20×20 pixels. Use a higher-resolution source rather than enlarging the Toolbar itself. Preserve the site name, test responsive states and keep frontend and backend behavior separate when that distinction matters.
TheOneWP Admin Bar Icon provides this customization through the Media Library. The verified implementation targets only the icon beside the site name, displays the selected image inside the native 20×20 area, hides the existing Site Icon image to prevent duplicates, preserves the source image aspect ratio with contained background rendering and limits the replacement to the WordPress administration area.
The result should be a small but useful identity cue that makes wp-admin easier to recognize without changing the Toolbar’s normal navigation behavior.

