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 a post type/single page that I'm using to create iframe widgets for embedding on other sites and blogs. The admin bar code is creating that extra 28px space at the top, and if I try to include it in a wordpress text widget, it screws with the existing admin bar on the hosting site for the iframe. I'm using a custom single and custom header file, wondering how I can lose the bar and css associated with it entirely just for that content. Thanks! (also posted on wordpress.org)

share|improve this question
I can't answer my own question yet, cause I'm new, but here's the solution I found, from yoast: in functions.php: if ( isset($_GET['bar']) && 'no' == $_GET['bar'] ) add_filter( 'show_admin_bar', '__return_false' ); "This would allow you to disable the WordPress admin bar by going to example.com/?bar=no, you can of course change those values." documentation: yoast.com/disable-wp-admin-bar This will work for my purposes, but requires a custom url. if anyone has any alternate suggestions, I'd be interested. – Wendy Nov 29 '11 at 21:37

You can add some code into your theme's functions.php file that checks the post type or whatever condition you want and when the condition is met, add this filter:

add_filter( ‘show_admin_bar’, ‘__return_false’ );

See this codex page for more information:


share|improve this answer
I just saw your own comment above. You can check for the post type by using the get_post_type() function: codex.wordpress.org/Function_Reference/get_post_type – ZweiBlumen Nov 29 '11 at 21:44

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.