Permalink
Browse files

only load ao_toolbar if is_admin_bar_showing

  • Loading branch information...
1 parent 235840a commit 9440b6efd2f3ffbeacb8709b866d4c0534213075 @futtta committed Sep 16, 2016
Showing with 1 addition and 1 deletion.
  1. +1 −1 classes/autoptimizeToolbar.php
@@ -15,7 +15,7 @@ public function __construct()
public function load_toolbar()
{
// We check that the current user has the appropriate permissions
- if( current_user_can( 'manage_options' ) && apply_filters( 'autoptimize_filter_toolbar_show', true ) )
+ if( current_user_can( 'manage_options' ) && apply_filters( 'autoptimize_filter_toolbar_show', true ) && is_admin_bar_showing() )
{
// Load custom styles and scripts
if( is_admin() ) {

5 comments on commit 9440b6e

Contributor

zytzagoo commented on 9440b6e Mar 6, 2017

This prevents toolbar's cache clear action (ajax) from working for me...

Because, is_admin_bar_showing() is false during ajax requests, ajax action registration never really happens during that ajax request, and so the hooked action is never fired...

Spotted while chasing some other stuff...

Owner

futtta replied Mar 6, 2017

good catch, had seen something like that but hadn't looked into that yet, will fix soon

Contributor

zytzagoo replied Mar 6, 2017

Works for me after doing this: zytzagoo/autoptimize@58d35be

Owner

futtta replied Mar 6, 2017

looks good, can you issue a PR @zytzagoo ?

Contributor

zytzagoo replied Mar 6, 2017

Please sign in to comment.