• Resolved sbbs

    (@sbbs)


    Hello,

    We use JetEngine from Crocoblock and WPO on our website.
    JetEngine offers 2 different types of custom post types that can be created.
    With both, WPO does not automatically purge the cache as soon as a post is changed, deleted or added.

    1. JetEngine: Custom Post Types
      To clear the cache here, the following function is working (added with code snippets).
    2. JetEngine: Custom Content Types
      unfortunately the function above does not work for them.
      JetEngine offers the following hooks with which you can probably trigger a Cache Purge:
      https://gist.github.com/Crocoblock/a9be7dbb1cb05aa2741aec97757c7f72#hooks

    I would like to use this one, which says, do “something” after item updated

    add_action(
    ‘jet-engine/custom-content-types/updated-item/’ . $cct_slug,
    function( $item, $prev_item, $item_handler ) {
    //do something
    },
    0,
    3
    );

    the “do something” should be a complete Cache Purge.
    How do I get this to work?
    I found the following code on the WPO FAQ page:

    // Add a new action that will trigger a cache purge
    add_filter( ‘wpo_purge_cache_hooks’, function( $actions ) {
    $actions[] = ‘my_custom_action’;
    return $actions;
    } );

    But I can’t get the two to work in combination.
    Can anyone help? I’m certainly not the first one with this problem

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support vupdraft

    (@vupdraft)

    * Purge the whole cache if set to true, only the edited post otherwise. Default is false.

    *

    * @param boolean $purge_all_cache The default filter value

    * @param integer $post_id The saved post ID

    */

    if (apply_filters('wpo_purge_all_cache_on_update', false, $post_id)) {

    $this->purge_cache();

    return;

    } else {

    if (apply_filters('wpo_delete_cached_homepage_on_post_update', true, $post_id)) WPO_Page_Cache::delete_homepage_cache();

    WPO_Page_Cache::delete_feed_cache();

    WPO_Page_Cache::delete_single_post_cache($post_id);

    WPO_Page_Cache::delete_post_feed_cache($post_id);

    }

    }
    Plugin Support vupdraft

    (@vupdraft)

    The above is the relevant code in the WPO plugin.

    Unfortunately as the plugin is a paid one, I am unable to access their code to look at and I am unable to test the plugins behaviour so the best I can do is point you to some of our code that might be useful to you.

    The Jet Engine/Crocoblock support would be better placed to assist as I am fairly limited in what I can do in the forums.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.