Support

Account

Home Forums Add-ons Options Page Clear WP Super Cache on Update

Solved

Clear WP Super Cache on Update

  • I have several custom fields on an Options page for my theme.

    I know how to have WP Super Cache clear it’s cache using a custom function and wp_cache_clear_cache();, but what function would I use for the ACF side of things so that I could call wp_cache_clear_cache(); when the Options page gets updated?

  • you can add and acf/save_post action

    
    add_action('acf/save_post', 'clear_cache_on_options_save');
    function clear_cache_on_options_save($post_id) {
      // you can check for options or not
      if ($post_id == 'options') {
        wp_cache_clear_cache();
      }
    }
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.