Prevent caching of user-specific pages

No guarantee, but it should help with some cache plugins.
This commit is contained in:
Tetrakern 2024-07-23 01:47:52 +02:00
parent e0d4430d40
commit e0bf599995
3 changed files with 21 additions and 0 deletions

View File

@ -18,6 +18,13 @@ if ( ! is_user_logged_in() && ! get_option( 'fictioneer_enable_public_cache_comp
exit; exit;
} }
// Try to prevent caching of the page
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
define( 'DONOTCACHEPAGE', true );
}
do_action( 'litespeed_control_set_nocache', 'nocache due to user-specific page.' );
// Setup // Setup
$current_tab = sanitize_key( $_GET['tab'] ?? '' ); $current_tab = sanitize_key( $_GET['tab'] ?? '' );
$order = fictioneer_sanitize_query_var( $_GET['order'] ?? 0, ['desc', 'asc'], 'desc' ); $order = fictioneer_sanitize_query_var( $_GET['order'] ?? 0, ['desc', 'asc'], 'desc' );

View File

@ -18,6 +18,13 @@ if ( ! is_user_logged_in() || get_option( 'fictioneer_enable_public_cache_compat
exit; exit;
} }
// Try to prevent caching of the page
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
define( 'DONOTCACHEPAGE', true );
}
do_action( 'litespeed_control_set_nocache', 'nocache due to user-specific page.' );
// Setup // Setup
$user = wp_get_current_user(); $user = wp_get_current_user();
$current_tab = sanitize_key( $_GET['tab'] ?? '' ); $current_tab = sanitize_key( $_GET['tab'] ?? '' );

View File

@ -33,6 +33,13 @@ if ( ! is_user_logged_in() ) {
exit; exit;
} }
// Try to prevent caching of the page
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
define( 'DONOTCACHEPAGE', true );
}
do_action( 'litespeed_control_set_nocache', 'nocache due to user-specific page.' );
// Setup // Setup
$post_id = get_the_ID(); $post_id = get_the_ID();
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();