Skip to content

Commit 483262f

Browse files
committed
fix: compatibility with cache_enabler #136
1 parent aaf2815 commit 483262f

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

inc/compatibilities/cache_enabler.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* Class Optml_cache_enabler.
5+
*
6+
* @reason Cache_enabler stores the content of the page before Optimole starts replacing url's
7+
*/
8+
class Optml_cache_enabler extends Optml_compatibility {
9+
10+
11+
/**
12+
* Should we load the integration logic.
13+
*
14+
* @return bool Should we load.
15+
*/
16+
function should_load() {
17+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
18+
19+
return is_plugin_active( 'cache-enabler/cache-enabler.php' );
20+
}
21+
22+
/**
23+
* Register integration details.
24+
*/
25+
public function register() {
26+
add_filter( 'cache_enabler_before_store', [ Optml_Main::instance()->manager, 'replace_content' ], PHP_INT_MAX, 1 );
27+
}
28+
29+
}

inc/manager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ final class Optml_Manager {
6464
'metaslider',
6565
'essential_grid',
6666
'yith_quick_view',
67+
'cache_enabler',
6768
);
6869

6970
/**

0 commit comments

Comments
 (0)