• Resolved ibro87

    (@ibro87)


    Hi there,

    I’m using WP-Optimize cache plugin and I need to clear the cache automatically when MyCred points balance change (e.g. user earns MyCred points by spinning lucky wheel). Is there any hook or filter that I can use in the functions.php file to achieve this? Thanks for your help!

Viewing 7 replies - 16 through 22 (of 22 total)
  • Hello @ibro87,

    Hope you are doing well.

    We have tried to help you as much as we can. Your query is not related to our plugin. We have told you that ‘mycred_add_finished’ filter triggers when the user gains or loses points.

    We suggest you to contact their support and ask them what code can be added to ‘mycred_add_finished’ filter to clear the cache. We are not familiar with the WP Optimize Cache plugin.

    Let us know if they need anything/information from our plugin code. We will help you out.

    Thanks & Regards,
    WP Experts Support Team

    Thread Starter ibro87

    (@ibro87)

    Hi Daniyal Raza,

    I totally get that this is not directly related to your plugin and I really appreciate your willingness to help.

    Unfortunately, WP-Optimize support is terrible and they are very difficult to communicate with. They asked me to exclude specific pages from caching which obviously is not an option for me because spinning wheel is used on every page. They also shared some example codes in this thread which I did not find useful at all but you can also check if you want.

    To be totally honest, I do not think they are capable of providing any better support than they have already provided. Thanks again for your willingness to help!

    Hello @ibro87,

    We try using the same code below according to your use case. We replicate the same scenario on our environment and used the below code. It’s working fine.

    add_filter( 'mycred_add_finished', 'check_for_balance_change', 1000, 3 );function check_for_balance_change( $reply, $request, $mycred ) {if ( $reply === true ) {   wpo_cache_flush();
     
    } return $reply;}

    If this code is not working for you then it might be server side cache issue on your end. You need to contact your hosting provider to disable the cache of server.

    Hope you understand now.

    Thanks

    Thread Starter ibro87

    (@ibro87)

    Hey Daniyal Raza,

    Sorry, I have taken so long to reply. This code actually does exactly what I need. Thank you so much for this, this is very helpful! ??

    hello… i have the same issue, but where will I place the filter code @daniyalraza01 @ibro87

    • This reply was modified 6 months, 3 weeks ago by supertee1.

    Hello @supertee1 ,

    You need to add this code into your active theme functions.php file.

    If you still face any issue then please open a new threat as this thread is resolved.

    Thankyou

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @supertee1,

    You can use WP-Optimize cache plugin for clearing the cache. Place the below code snippet in your themes functions.php file to the active theme.

    Here is the code:

    add_filter( 'mycred_add_finished', 'check_for_balance_change', 1000, 3 );
    
    function check_for_balance_change( $reply, $request, $mycred ) {
    
    if ( $reply === true ) {  
    
     wpo_cache_flush();
     
    } 
    
    return $reply;
    
    }
    

    If you have any questions, feel free to reach out. We’re here to assist you.

    Thank you

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Purge cache automatically when balance change’ is closed to new replies.