LSC caches pages w/o considering new scripts from child theme’s functions.php
-
I’ve cleared the cache several times and created a new one, including purging all, but all to no avail, the new scripts are ignored, they’re not added to the page cache, even though they’re present on the pages before/without caching. These scripts are not added to any exceptions. This includes the script that must be present on every page of the site, so it is not just a matter of some pages not being cached correctly. It’s about two scripts that were recently added to the functions.php. All scripts added to pages earlier via the same functions.php are cached perfectly.
Here is an example of the script that is not cached (part of functions.php):
function cmplz_hide_banner() {
ob_start(); ?>
<script>
document.addEventListener("cmplz_before_cookiebanner", function() {
cmplz_set_banner_status('dismissed');
});
</script>
<?php
$script = ob_get_clean();
$script = str_replace(array('<script>', '</script>'), '', $script);
wp_add_inline_script( 'cmplz-cookiebanner', $script);
}
add_action( 'wp_enqueue_scripts', 'cmplz_hide_banner', PHP_INT_MAX );Thank you!
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.