Plugin Directory

Changeset 1865311


Ignore:
Timestamp:
04/27/2018 09:58:12 AM (7 years ago)
Author:
salaros
Message:

fixes #2 - Cache clear button doesn't work on frontend (with admin bar)

Location:
wp-purge-pagespeed-button/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-purge-pagespeed-button/trunk/readme.txt

    r1801754 r1865311  
    33Tags: google, pagespeed, mod_pagespeed, cache, purge, clear
    44Requires at least: 4.5.0
    5 Tested up to: 4.9.1
    6 Stable tag: 10.0.0
     5Tested up to: 4.9.5
     6Stable tag: 0.0.0
    77License: MIT
    88License URI: https://opensource.org/licenses/MIT
  • wp-purge-pagespeed-button/trunk/wp-pagespeed-purge.php

    r1801754 r1865311  
    44* Plugin URI:  https://github.com/salaros/wp-purge-pagespeed-button
    55* Description: One-click PageSpeed cache purging using an admin bar button
    6 * Version:     10.0.0
     6* Version:     0.0.0
    77* Author:      Zhmayev Yaroslav aka Salaros
    88* Author URI:  https://salaros.com
     
    2121    public function __construct() {
    2222        // Enqueue css and js files
    23         add_action( 'admin_enqueue_scripts', array( $this, 'embed_admin_assets' ), 101 );
     23        if( ! is_admin() && is_admin_bar_showing() ) {
     24            add_action( 'wp_enqueue_scripts', array( $this, 'embed_admin_assets' ), 101 );
     25        } else {
     26            add_action( 'admin_enqueue_scripts', array( $this, 'embed_admin_assets' ), 101 );
     27        }
    2428
    2529        // Add 'Clear Redis cache' button to the admin bar
     
    6165}
    6266
    63 new PageSpeedPurge();
     67add_action( 'plugins_loaded', function () {
     68    new PageSpeedPurge();
     69} );
Note: See TracChangeset for help on using the changeset viewer.