Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache plugins - Disable cache when view is active. #128

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions includes/class-compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ public function init() {
*/
public function init_after() {

// Cache plugins.
if ( VAA_API::is_view_active() || defined( 'VAA_DOING_AJAX' ) ) {

// WP Rocket & WP Super Cache
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
define( 'DONOTCACHEPAGE', true );
}

// WP Rocket.
// @link https://github.com/wp-media/wp-rocket-helpers/blob/master/cache/wp-rocket-no-cache-for-admins/wp-rocket-no-cache-for-admins.php#L71-L83
if ( ! defined( 'DONOTROCKETOPTIMIZE' ) ) {
define( 'DONOTROCKETOPTIMIZE', true );
}

// LiteSpeed.
// @link https://docs.litespeedtech.com/lscache/lscwp/api/#set-current-page-as-non-cacheable
do_action( 'litespeed_control_set_nocache', 'View Admin As' );
}

if ( VAA_API::is_user_modified() ) {
// Only apply the filter if the current user is modified.
$this->add_filter( 'pods_is_admin', array( $this, 'filter_pods_caps_check' ), 99, 2 );
Expand Down