• Resolved tkwpweb

    (@tkwpweb)


    Hello,

    i am using this filter to compress css and js files with gz:

    if (is_plugin_active(‘autoptimize/autoptimize.php’)) {
    add_filter(‘autoptimize_filter_cache_create_static_gzip’, ‘__return_true’);
    }

    I am using 2.6.1 – looks like this filter dont work anymore. I only have the normal css and js files in cache Folder… not the gz version. Maybe a nice solution when you can implement this Feature as a Checkbox in AO settings. This is much easier and i dont know… but maybe 99% of all Browsers support them…

    Whats about Brotli… Do you know a native way to implement this? For me, i only can find a PHP Brotli extension at Github.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmmm … no changes in AO that could have broken this as far as I know. re. your code; is_plugin_active() is not available when in frontend (unless you include a specific file), so that’s a first problem. the quotes uses here are ticks iso single (or double) quotes, but that could be a copy/paste issue.

    re. adding as option; there are a lot of options I _could_ add, but I want to keep the UI somewhat clean.

    re. brotli; not in PHP, but there is a PHP module which AO does check for, see https://github.com/futtta/autoptimize/blob/97e27fa705d6848733fa5c796b37b332c09526d1/classes/autoptimizeCache.php#L125-L128

    hope this clarifies,
    frank

    Thread Starter tkwpweb

    (@tkwpweb)

    Damn… i am stupid xD My mistake… it works.

    I used an old version from my small Dashboard Widget Plugin (where the filter is in).

    I am not a programmer, what do you mean with “is_plugin_active() – Problem”?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I mean that the is_plugin_active function (by default) is only available when in the backend (wp-admin). I would simply remove the check and just keep the add_filter-line; if AO is not there, the filter does nothing, there’s no disadvantage in running always running that add_filter really ??

    Thread Starter tkwpweb

    (@tkwpweb)

    At the Moment the AO Snippet is:

    include_once(ABSPATH.’wp-admin/includes/plugin.php’);

    if (is_plugin_active(‘autoptimize/autoptimize.php’)) {
    add_filter(‘autoptimize_filter_cache_create_static_gzip’, ‘__return_true’);
    }

    And now you mean i only use:

    add_filter(‘autoptimize_filter_cache_create_static_gzip’, ‘__return_true’);

    …correct?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    And now you mean i only use add_filter(‘autoptimize_filter_cache_create_static_gzip’, ‘__return_true’); … correct?

    indeed, simpler = better ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘GZip Filter Bug – Brotli?’ is closed to new replies.