• Resolved Mojtaba

    (@mojtaba-taheri)


    I’m on a LiteSpeed server and use LiteSpeed chace plugin.

    I am using Advanced Custom Fields plugin, and set up a ‘User Options’ page where the user can set values to some ACF fields. Those ACF fields values should be displayed on some pages for that specific user.

    The problem is that, when the user updates the ACF fields, those changes doesn’t show up until I purge cache manually.

    I want to be able to clear cache automatically for specific pages, when a user updates some ACF fields.

    How can I achieve this, using action hooks or any other tool from both plugins?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yes, you can add the hook on our plugin for auto purging, please try to add acf/update_value to LiteSpeed Cache > Setting > Advance > Purge All Hooks.

    Plugin Support Hai Zheng⚡

    (@hailite)

    Hi, can you give some examples which certain pages you want to be purged? And what cache tags does it have?

    Thread Starter Mojtaba

    (@mojtaba-taheri)

    Thanks @hailite for the reply, I want to clear cache for a specific post type that I have created in my theme.

    Thanks @stanleylitespeed I added acf/update_value to purge all hooks, but it didn’t clear the cache. On the other hand, I don’t want to purge ALL caches, I am looking for a way to purge the cache for a specific post type.

    Plugin Support Hai Zheng⚡

    (@hailite)

    I felt its not a general case that can be covered by LSCWP. Maybe you should do the purge by custom codes in theme.

    Thread Starter Mojtaba

    (@mojtaba-taheri)

    @hailite yes definitely; I know that it should be done by custom code, but I was unable to accomplish that. It would be great if you could give some hints on how to do it.

    Plugin Support Hai Zheng⚡

    (@hailite)

    1. Find the tags that specific pages are using. e.g. They all contain a cache tag xxx_tagA.

    2. Find the hook that ACF is using when updating the fields. e.g. It has do_action( 'update_field_a' );

    3. Add this to your theme’s functions.php:
    add_action( 'update_field_a', function(){ LiteSpeed_Cache_API::purge( 'update_field_a' ); } );

    The above is just a sample. If you don’t have PHP experience, you may need to get one PHPer to do the job.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Purge cache when Advanced Custom Fields field updated’ is closed to new replies.