Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor kporras07

    (@kporras07)

    Hi @janareddy could you please add a small snippet on how you’re calling that function? Please (I’d like to see at least one path example)

    Thanks!

    Thread Starter JanaReddy Mareddy

    (@janareddy)

    function clearImageCDNCache( $post_ID ) {
    
    ? ? $allImages ? ? = [];
    
    ? ? $attachments ? = get_attached_media( 'image', $post_ID );
    
    ? ? $uploads ? ? ? = wp_upload_dir();
    
    ? ? $imgFolderpath = str_replace( '/code/', '/', $uploads['basedir'] );
    
    ? ? foreach ( $attachments as $att_id => $attachment ) {
    
    ? ? ? ? $full_img_url ? ?= wp_get_attachment_metadata( $attachment->ID );
    
    ? ? ? ? $basename ? ? ? ?= $full_img_url['file'];
    
    ? ? ? ? $short ? ? ? ? ? = basename( $basename );
    
    ? ? ? ? if(!empty($basename)){
    
    ? ? ? ? ? ? $ImgFolder ? ? ? = str_replace( $short, '', $basename );
    
    ? ? ? ? ? ? $allImages[] ? ? = $imgFolderpath . '/' . $basename;
    
    ? ? ? ? ? ? $attachment_meta = get_post_meta( $attachment->ID, '_wp_attachment_metadata', true );
    
    ? ? ? ? ? ? foreach ( $attachment_meta['sizes'] as $key => $info ) {
    
    ? ? ? ? ? ? ? ? $allImages[] = $imgFolderpath . '/' . $ImgFolder . $info['file'];
    
    ? ? ? ? ? ? }
    
    ? ? ? ? }
    
    ? ? }
    
    ? ? if ( function_exists( 'pantheon_clear_edge_paths' ) && !empty($allImages)) {
    
    ? ? ? ? $cacheresp = pantheon_clear_edge_paths( $allImages );
    
    ? ? }
    
    }
    
    add_action( 'post_updated', 'clearImageCDNCache', 10, 1 );
    Plugin Contributor kporras07

    (@kporras07)

    Hi!
    I got advice from other Pantheon engineers that your site is using AGCDN and for this specific stuff, the recommendation is for you to contact Pantheon support please

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘cache not clering’ is closed to new replies.