MFunc not working with shortcode output
-
In this thread: https://www.ads-software.com/support/topic/mfunc-still-not-working/page/2?replies=13#post-4314177
Frederick says <q>mfunc code can only be used with theme template files, post/page content or widget areas</q>
I realise that shortcodes aren’t mentioned there, however since the post/page content includes parsed shortcodes, I am surprised that MFunc doesn’t work.
If I have a shortcode handler that outputs the following:
return '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' --> echo mt_rand(1,10000); <!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->'
When I visit the page including the shortcode, I will see the random number. However, this is cached as part of the page – if I reload the page I still see the same number.
It would be really nice to be able to use mfunc output by a shortcode.
Also, being able to filter the page cache key (
_getPage_key()
) would be really useful too.Sometimes you’ll have dynamic content that can change on each request, which mfunc would be good for. Other times you’ll have dynamic content that will be the same for sets of visitors, in which case being able to filter the page key would be more efficient.
- The topic ‘MFunc not working with shortcode output’ is closed to new replies.