Opened 13 years ago
Closed 12 years ago
#20101 closed defect (bug) (fixed)
Can't use 'show_admin_bar' filter with conditional tags
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Toolbar | Keywords: | 3.6-early dev-feedback |
Focuses: | Cc: |
Description
I'm trying to show the admin bar only on the front page:
function scribu_show_admin_bar() { return is_front_page(); } add_filter( 'show_admin_bar', 'scribu_show_admin_bar' );
However, this doesn't work because '_wp_admin_bar_init' is called on 'init', before the main WP_Query is set up.
Attachments (1)
Change History (20)
#4
@
12 years ago
- Milestone changed from Awaiting Review to 3.5
I could go for this.
I'd be curious what will break in doing this. (Surely it will be something...)
#8
@
12 years ago
I'm afraid this doesn't amend itself well to unit testing, so I could wax poetical about it all day, or we could just give it a soak in trunk and revert it if it breaks a lot of stuff.
#9
@
12 years ago
I'm bluffing; I can't write verbosely to save my life, but it does seem like a pretty low risk fix.
#10
@
12 years ago
I personally would be happy enough with you saying you tried running the patch yourself for a little while and didn't see anything weird with any of your fancy themes or complicated plugins like bbPress or BuddyPress :)
#11
@
12 years ago
I just tried it with the latest version of BuddyPress and, interestingly enough, it works.
It also works fine in bbPress, as expected.
#12
@
12 years ago
- Keywords punt removed
I can be reasonable. You can hash it out over actually getting it committed, though.
#13
@
12 years ago
- Keywords 3.6-early commit added
- Milestone changed from 3.5 to Future Release
I still have a bad taste in my mouth after #20161, which caused some (limited) grief for plugins, and actually caused enough issues on WordPress.com (because of some toolbar items they add) that they just reverted the change. I do think it is a good change, but let's do this early 3.6. (Seriously — the day we branch, someone hold me to it.)
#15
@
12 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 23512:
#16
@
12 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
This broke some things on wordpress.com. We've reverted it for now. I'll investigate whether what we are doing that triggers the problem is a remotely sane thing to do. :-) Meanwhile, I'll reopen this as a reminder.
I also tried this variation:
which almost worked: I got the blank space mentioned in #16249