Title: mfunc doesn&#039;t work
Last modified: August 30, 2016

---

# mfunc doesn't work

 *  Resolved [talgat](https://wordpress.org/support/users/talgat/)
 * (@talgat)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/mfunc-doesnt-work/)
 * [@arnan](https://wordpress.org/support/users/arnan/),
 * mfunc doesn’t work. You use a secret code only for a “mfunc”. And not for a closing“/
   mfunc”. Now I turned off W3 Total Cache support and use next code instead of 
   AdRotate widget:
    <!– mfunc secret_code –> echo adrotate_group(2); <!– /mfunc
   secret_code –>
 * For a standard Text widget it need to remove line breaks to prevent an eval error.
   So it will looks like:
    <!– mfunc secret_code –>echo adrotate_group(2);<!– /mfunc
   secret_code –>
 * Also when mfunc doesn’t work impressions work for the dynamic mode only. For 
   the standard mode impressions count one time (before a page will be cached). 
   With the mentioned above solution mfunc and impressions work fine.
 * AdRotate 3.14 free.
    WordPress 4.3.1
 * Regards, Talgat
 * [https://wordpress.org/plugins/adrotate/](https://wordpress.org/plugins/adrotate/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Arnan de Gans](https://wordpress.org/support/users/adegans/)
 * (@adegans)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/mfunc-doesnt-work/#post-6805388)
 * I’ve followed the manual and had some trial and error to get the current implementation
   working.
 * If I change it to what you say, W3TC gives errors about things not being set 
   up right. The current method works for me and many others.
 *  Thread Starter [talgat](https://wordpress.org/support/users/talgat/)
 * (@talgat)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/mfunc-doesnt-work/#post-6805392)
 * [@arnan](https://wordpress.org/support/users/arnan/),
 * My suggestion works only for the text widget and themes templates. If just add
   a secret code to “/mfunc” in adrotate-functions.php and adrotate-widget.php it
   shows an eval error. I didn’t learn yet how to solve it.
 * If I’m not mistaken “/mfunc” without a secret code doesn’t work since WordPress
   4.1
 * Anyway I have notified you.
 * Regards, Talgat
 *  Thread Starter [talgat](https://wordpress.org/support/users/talgat/)
 * (@talgat)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/mfunc-doesnt-work/#post-6805398)
 * [@arnan](https://wordpress.org/support/users/arnan/),
 * This is the error message from W3TC PgCache.php. Please look at the format.
 * “Invalid mfunc tag syntax. The correct format is: <!– W3TC_DYNAMIC_SECURITY mfunc
   PHP code –><!– /mfunc W3TC_DYNAMIC_SECURITY –> or <!– W3TC_DYNAMIC_SECURITY mfunc–
   >PHP code<!– /mfunc W3TC_DYNAMIC_SECURITY –>.”
 * I have found the way how to solve the error which you got with implementation
   this correct format.
 * For example, for the adrotate-widget.php the code should looks like:
 *     ```
       if($adrotate_config['w3caching'] == 'Y')
         echo "echo adrotate_group(".$instance['adid'].", 0, 0, 0);";
       else
         echo adrotate_group($instance['adid'], 0, 0, 0);
       ```
   
 * For the adrotate-functions.php
 *     ```
       if($adrotate_config['w3caching'] == "Y")
         $output .= "echo adrotate_group($group_ids, 0, 0, 0);";
       else
         $output .= adrotate_group($group_ids, 0, 0, 0);
       ```
   
 * The same way for the call **adrotate_ad** function.
 * Regards, Talgat
 *  Thread Starter [talgat](https://wordpress.org/support/users/talgat/)
 * (@talgat)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/mfunc-doesnt-work/#post-6805498)
 * Thank you for the fix.
 * Regards, Talgat

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘mfunc doesn't work’ is closed to new replies.

 * ![](https://ps.w.org/adrotate/assets/icon-256x256.gif?rev=3117289)
 * [AdRotate Banner Manager](https://wordpress.org/plugins/adrotate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/adrotate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/adrotate/)
 * [Active Topics](https://wordpress.org/support/plugin/adrotate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/adrotate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/adrotate/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [mfunc](https://wordpress.org/support/topic-tag/mfunc/)

 * 4 replies
 * 2 participants
 * Last reply from: [talgat](https://wordpress.org/support/users/talgat/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/mfunc-doesnt-work/#post-6805498)
 * Status: resolved