For some reason we get error 50 when using the following code in our template (Changed the id in this example):
<!– mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
echo do_shortcode(‘[3cx-clicktotalk id=”0000″ title=”Chat and call with Support”]’);
<!– /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
While the following code is working fine:
<!– mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
echo date(“H:i:s”);
<!– /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
To make sure it is not an issue with shortcodes we tested the following code, which is working fine as well (changed the ID):
<!– mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
echo do_shortcode(‘[contact-form-7 id=”00″ title=”Contact form”]’);
<!– /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
So the issue looks like to be an compatibility issue between fragment caching and the 3CX Live Chat and Talk plugin.
Do you have solution for this?
]]>For some reason we get error 50 when using the following code in our template (Changed the id in this example):
<!– mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
echo do_shortcode(‘[3cx-clicktotalk id=”0000″ title=”Chat and call with Support”]’);
<!– /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
While the following code is working fine:
<!– mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
echo date(“H:i:s”);
<!– /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
To make sure it is not an issue with shortcodes we tested the following code, which is working fine as well (changed the ID):
<!– mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
echo do_shortcode(‘[contact-form-7 id=”00″ title=”Contact form”]’);
<!– /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
So the issue looks like to be an compatibility issue between fragment caching and the 3CX Live Chat and Talk plugin.
Do you have solution for this?
]]><meta property="og:description" content="...PHP code...">
<meta name="twitter:description" content="...PHP code...">
To reproduce the problem configure W3TC to use fragment caching and then put some short piece of code at the top of the content where the description is taken from (start of the post).
For example, use this code (you can replace php code with W3TC_DYNAMIC_SECURITY with your ID):
<!-- mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
echo '<div>YOAST SEO TEST1</div>';
echo '<div>YOAST SEO TEST2</div>';
echo '<div>YOAST SEO TEST3</div>';
<!-- /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
If you check meta descriptions you’ll see PHP code there.
It seems Yoast SEO takes (cached) page before it is processed by W3TC and PHP code is executed.
]]>Is it possible to serve dynamic content with your plugin?
I am looking for a caching plugin I can use together with the if-so plugin (https://www.ads-software.com/plugins/if-so/). I understand I should look for a “fragment caching” option but did not find it.
]]><?php if (!defined('W3TC_DYNAMIC_SECURITY')) { define('W3TC_DYNAMIC_SECURITY', md5(rand(0,999))); } ?>
<!--mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
echo do_shortcode('[wt_geotargeting get="city"]');
<!--/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
Weirdly it doesn’t work on 10% of the pages on my site, it displays “echo do_shortcode('[wt_geotargeting get="city"]');
” instead of the city name
Do you have any idea?
]]>Is there any way to disable caching of specific shortcodes on a page? I am using AmazonAssociatesLinkBuilder(AALB) plugin which shows geo-targeted ads(ads depending on country of the customer). But due to caching, the first ad being rendered by AALB’s shortcode is shown to all customers from different countries. Is there any way to:
I’m following this tutorial: https://www.justinsilver.com/technology/wordpress/w3-total-cache-fragment-caching-wordpress/
So, I’m using Page cache method Disk: Basic with Late initialization enabled. All other caches are disabled. Also, I added this
define( 'W3TC_DYNAMIC_SECURITY', md5( rand( 0, 999999 ) ) ); // random "secret"
to my wp-config.php file.
And here is my code, that I try exclude from cache (it is placed inside single.php file):
<!--mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
<?php
echo 'The time is: '.date( 'H:i:s', time() )." <br>";
?>
<!--/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
Also I noticed, that this message: “Unable to execute code:” appears only on first page load. After that, page loads with same cached time: “The time is 13:27:38”
Any help will be appreciated.
]]>1. Purchase the pro version. Apparently, fragment caching is now available only in the pro version.
2. Set the page cache to Disk:Basic.
3. Turn on late initialization under the Page Cache settings section.
4. Added mfunc to ignored comment stems under HTML & XML minify settings
5. Added this line to wpconfig: define( ‘W3TC_DYNAMIC_SECURITY’, ‘WIPDynContent’ );
6. Added a date echo to the screen and wrapped in the mfunc comment to exclude it from caching, like this:
?>
<!– mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
<?php
$date = new DateTime();
echo $date->format(‘Y-m-d H:i:s’) . “\n”;
?>
<!– /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
<?php
Even using this simple example the html block is cached. Disabling w3 total cache allows the dynamic content to update, and shows that no other caching scheme is executing, only w3tc.
I’ve seen several other posts raising this issue but no resolution.
]]><!--mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
$country_name = (function_exists('get_country_name') && get_country_name() != '')?get_country_name():'usa';
echo $country_name;
<!--/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
This works, but only for logged in users.
Any idea where did I go wrong?
Many thanks in advance.
<!-- mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> echo current_time('timestamp'); --><!-- /mfunc -->
This code is working when page is loaded first time only.
<!-- mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> echo get_query_var('city'); --><!-- /mfunc -->
After page reload get_query_var(‘city’) is empty.
How can I fix it?
]]>