0
votes

Admin bar appears after adding code to the functions.php

add_filter( 'show_admin_bar', '__return_true' );

but empty except for the WP logo and the search on the right.

I installed latest version of twentyTwelve, it didn't appear,after adding the same code to the theme's functions.php it appears with the same problem.

So I don't think it has to do with the theme.. So I deactivated all plugins, And I still have the same problem.

Imgur

Note: There is no problem with the admin bar in the Dashboard. Also I checked the HTML structure, it's not hidden by CSS.

<?php wp_footer(); ?> + <?php wp_header(); ?> are defined in the themes header and footer.

1
It works in the dashboard but not when viewing your site? What happens when you change themes? - Omnikrys
Same thing, I changed the theme to TwentyTwelve same issue. - Bilal Khoukhi
Odd, did you try a new theme (freshly downloaded)? If all plugins are removed and a fresh theme is doing it I'd replace everything with a fresh copy then drop in your old wp-config and see if it still does it. - Omnikrys
Yes I tried a fresh installation of twentyTwelve theme. I'll try what you suggested and get back here - Bilal Khoukhi
Another thought... got an ad blocker running on your browser? Tried different browsers? - Omnikrys

1 Answers

1
votes

If the toolbar is forced to load (via show_admin_bar) but a user is not logged in it has nothing to show the user. When this happens it looks exactly like your screen shot with just the WP and search icons present. The toolbar will load anytime a user is logged in though so there is no reason to force it to load unless you intend to modify its behavior to include actions for anonymous users.

I was able to recreate this easily in a clean install but only if there was no user logged in. If this is happening to you when a user is logged in then I suggest a fresh install of WP in a subdirectory, or locally, then enabling your theme and plugins one by one until it breaks so you know which component is causing the problem.