Attachments, images and media

On this page the terms attachment, image and media are used interchangably. Strictly speaking, only media attached to a post can be called an attachment.

Post attachments are automatically broadcasted to the child posts upon publishing / updating. Other media may also be copied at the same time.

  • Featured images
  • Media references in shortcodes in the post
  • Media references in custom fields using various add-ons

How media is handled during a Broadcast

Preparations on the parent blog

When the publish button is pressed, Broadcast will:

  1. Take a note of all media IDs directly attached to the post.
  2. Note the featured image ID, if any.
  3. Examine all gallery shortcodes and all media IDs found within are noted.
  4. Various add-ons will try to find media IDs in various places, for example:

Preparations on the child blog

If the child post already exists, Broadcast will delete all attached media. This is to ensure that all media is kept updated on all child blogs. The deletion can be prevented by using the Protect Child Properties or Update Attachments add-ons.

After the attachments are cleared, Broadcast will try to copy all media.

Copying the media

One after one, all attachments are attempted to be copied to the child blog.

Broadcast will first check to see if a media file with the exact same slug already exists on the blog. If so, the admin setting existing attachments dictates the action to take:

  1. The existing media can be used.
  2. The existing media can be deleted and recopied (overwrite).
  3. The name of the media can be modified slightly when being copied (randomize)

The default is to use the existing media ID.
Using option #2 can result in broken links if other posts reference the same media.
Option #3 will generate very many duplicates.

Each copied media will result in the metadata and thumbnails being regenerated. This usually takes a few seconds per image. To save time and help prevent PHP timeouts, the Duplicate Attachments add-on will directly copy the media without regenerating anything.

Modifying the media IDs

In the case of gallery shortcodes, the contained media IDs are modified to point to the equivalent media on the child post. If you use other shortcodes that contain media IDs, you should have a look at the Shortcode Attachments add-on.

Featured images

A featured image, which WordPress internalls calls a thumbnail, will automatically be copied whether attached to the post or not.

Comments

  1. Is posible to switch off this feature? For example i do not need to copy files if they are reachable on the paretn site… thanks!

    1. Not currently, no. Are the attachments part of a gallery or a featured image or something?

  2. Hi,
    I am using SiteOrigin Page Builder and when I broadcast pages that are managed with the builder, my images disappear. What’s very strange is that the HTML of page actually changes. So instead of:

    I get this, on my child site:

    As you can see, the entire ‘src’ attribute disappeared from the ‘img’ tag, therefore nothing is displayed on my child page.
    How can I fix this and broadcast images that are within page builder?
    Thanks!

    1. It looks like your HTML got stripped out. You should e-mail me your code and a debug dump and we can then see what we can see.

  3. Is it still not possible to stop the images from being copied and simply have the link to the parent site? We have a client with a very large site with 15+ child sites so this is becoming a huge issues for our client’s hosting.

    1. Still not possible due to technical limitations in WordPress: all media on each blogs needs its own ID.

      You can try a CDN, that does not store images on disk, such as the WP Offload S3 Lite plugin, which others have successfully tested with Broadcast.

    1. You mean, instead of physically copying the files, they are symlinked and then inserted into the media library?

  4. Hello,

    we’re setting up a Multi-Site on WordPress and we figured out a massive problem with post/featured images.

    When we set up a featured image, the main site will show it and all the sub-pages will ignore it on the blog main-page.

    The image itself is copied under the “media section”, but isn’t linked with the child post item.

    Is there any setting which needs to be enabled?

    A lot of posts were already written – sometimes the featured image is linked and now no new post will do that.

    Hopefully you can help us!

    Best regards,
    Stefan

    1. What do you mean by “sub-pages will ignore it on the blog main-page”?

  5. we publish the posts on the main-site and broadcast it to the other pages – and the child-pages won’t show the image on the site. neither on the blog overview nor on the single post page.

    1. Could you e-mail me a debug dump of the post in question? I’d like to see what broadcast is doing with the images.

  6. Ok, please write me a mail with a short description how I could do this (you see my mail-address or?)

    Then I’ll forward the dump to you when you’ve provided me a short tutorial :)

    1. For others wondering, the problem was that the “custom fields” Broadcast checkbox was not checked during broadcasting. Therefore BC ignored the featured image, since it is stored in a custom field.

  7. Hi. I use broadcast plugin to share content on big (100+) multisites.
    I don’t need to replicate images on every site, and I’m thinking to couple broadcast to a “shared media library” plugin like this https://it.wordpress.org/plugins/network-shared-media/ (not this, but something similar, there are a lot).
    Have you an extension to handle something like this?
    Have someone experience on something similar? I’m a developer, it’s not a problem to write some code to make the mix.

    1. There is no elegant solution.

      WordPress handles attachments by ID, and since each blog has different IDs for the same images, there will have to be copies of the image on each blog.

      The usual solutions are either to get bigger web hosting (there are places that offer 2TB of warm storage for 20e a month), use a CDN offloading plugin (S3 Lite seems to work well) or referring to images statically instead of dynamically using image IDs.

      I just recently helped someone cut down on 80% of their site size by putting all broadcasted images onto a shared directory, and the images were then refereced statically.

Leave a Reply

Your email address will not be published. Required fields are marked *