WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have used add_action('admin_bar_menu', 'modify_admin_bar') to change the admin bar on the "front end" of WordPress (the site the user sees). However, it seems that modify_admin_bar() is not called before the admin bar is rendered on the "back end" (the Dashboard or admin side of WordPress).

How can I modify the admin bar as it is presented on the admin side of WordPress?

Here's an example...

add_action( 'admin_bar_menu', 'modify_admin_bar', 95 );
function modify_admin_bar() {
    error_log('admin barring');

In this example, my error log shows "admin barring" every time I refresh a page on the user side of WordPress, but never shows "admin barring" when I refresh the admin side (the Dashboard) of WordPress. It does not seem that the function gets called from the admin side. I am running WP 3.5.

share|improve this question
Please show us the whole function, admin_bar_menu is called very late and works by default for front-end and admin. – Wyck Dec 12 '12 at 5:28
I have just confirmed the same behavior in a WP 3.4.2 site. There is clearly something I don't understand about the admin_bar_menu action. – EFC Dec 12 '12 at 15:42

Blush... the answer turned out to be a bit obvious...

The function error_log() was writing to two different logs on my system. One log was showing the errors when on user-facing pages, another log was showing errors on admin pages.

The plugin was working just fine, but I was not looking at the admin error log. Oops!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.