WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
CDN: All attachments are uploaded twice (2 posts)

  1. Joe Hoyle
    Human Made
    Posted 3 years ago #

    I was experiencing slow uploads to the CDN, so I was digging around in the code, and found that when you upload a new image to the Media Library, every image (including all size variants) are uploaded twice.

    This is because both update_attached_file and add_attachment hooks are fired when you upload a new image. See http://core.trac.wordpress.org/browser/trunk/wp-includes/post.php#L3649 (which is in wp_insert_attachment()) update_attached_file() is called then the add_attachment action is called 9 lines later.

    This also happens for all attachment size variants. I presume w3tc could only hook in on update_attached_file.

  2. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    Interesting, I'll investigate.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic