• Hi. I’ve written some custom functions into my theme to take advantage of the cache purge capability. I’m able to get the cache cleared on CPT archive pages when a specific custom post type is added or modified. But for the life of me I can’t get it to do a purge on a single page. Can you look over the code I’ve written below and see if I’m doing something obviously wrong?

    add_action( 'save_post', 'clean_post_cache_on_save');
    
    function clean_post_cache_on_save( $post_id) {
    
    // check whether the plugin "Pantheon Advanced Page Cache" exists the it's function clean_post_cache exists
    
    if ( ! function_exists( 'pantheon_clear_edge_paths' ) ) {
    
    return;
    
    }
    
    // Ignore revisions, which aren't ever displayed on the site.
    
    $type = get_post_type( $post_id );
    
    if ( $type && 'revision' === $type ) {
    
    return;
    
    }
    
    clean_post_cache( $post_id );
    
    }
  • The topic ‘can’t get a single post to clear upon update’ is closed to new replies.