Files
2024_WEBSITE_fipf/plugins/fipfcard_plugin/php/test_cache.php

34 lines
852 B
PHP

<?php
/**
* it means someone outside wp is accessing the file, in this case kill it.
*/
if (!defined('ABSPATH')) {
die('You can not access this file!');
}
function prevent_page_caching( $headers ) {
error_log("in prevent_page_caching");
if (is_page('test-form-modals')) {
error_log("in test-form-modals");
$headers['Cache-Control'] = 'no-cache, no-store, must-revalidate';
$headers['Pragma'] = 'no-cache';
$headers['Expires'] = '0';
}
return $headers;
}
add_filter( 'nocache_headers', 'prevent_page_caching' );
function add_custom_meta_tags() {
error_log("add_custom_meta_tags");
echo '<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">';
echo '<meta http-equiv="Pragma" content="no-cache">';
echo '<meta http-equiv="Expires" content="0">';
}
add_action('wp_head', 'add_custom_meta_tags');
?>