1

I have done some weird things with a few custom theme pages. Namely, i have bypassed the wp_query and obtained data from a different db. I populate the post object with custom data and then inject this into my theme. Since the toolbar shows up fine normally, there must be some sort of trigger that i am bypassing by not calling the wordpress DB. I am 100% sure the theme is not the cause of the issue here, it is the messing that i have done. However, there are no errors in the code, everything works good. What does the admin toolbar require in order to load? Is there some hook i can call manually in order to make it render?

I have tried messing around with the code and info from the wordpress docs https://codex.wordpress.org/Function_Reference/show_admin_bar

  • first make sure you are logged in, if your user session has timed out during your dev work it will disappear... probably obvious but has happened to me. – majick Jul 9 '17 at 2:39
  • 2
    This answer might be helpful: wordpress.stackexchange.com/a/240152/2807 – Dave Romsey Jul 10 '17 at 0:53
0

Perhaps one of the things you did to templates was remove this from your footer?

wp_footer();

0

Daves comment to the question was the solution to this. Because i was calling wp-load.php and bypassing the theme, the template redirect hook was never being called and this prevented the admin bar from appearing on the website. Calling the method listed in his linked answer solved the issue. wordpress.stackexchange.com/a/240152/2807

You can make the admin bar show up by calling

_wp_admin_bar_init();

Be careful with it though, I ended up calling it and it somehow started getting cached in the html cache meaning the admin bar got served to users that were not logged in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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