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)
  4. The Update Attachments will overwrite in place, without deleting the existing image

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.

    2. Hi Edward

      Did you have any more information about how you achieved your last comment regarding putting all images into a shared directory? I am keen to do something similar.

    3. The person went through their theme and posts, replacing all [gallery] shortcodes and image references using IDs, to static references using the IMG HTML tag. Everything was changed to a relative / complete URL to the image.

      It required a lot of work to clean up the theme to not use featured images anymore and to ensure that there were no more IDs used anywhere, but it was worth it for the person, since space was expensive.

      For me, I pay 10€ a month for 2TB of image storage, so it’s easiest for me to just use the default WordPress way of handling images.

      If this is still unclear, e-mail me and I’ll try to explain further.

  8. How to do that, when broadcasting links to pictures taken from the source site ?
  9. I used broadcast to copy a post to a subsite. The post had a featured image. All images and documents reference in the parent post were successfully copied into the media library of the subsite. Only the featured image reference was changed to pull the image from the subsite’s image library. All the rest of the references within the post pull images and documents from the parent page. Shouldn’t these also pull images and documents from the subsite’s library? I ran a debug when I did it. Also, I had all the checkboxes checked when I pushed the post to the subsite (Link this post to its children, custom fields, taxonomies). Should I send you the link to the debug page?
    1. By default, featured images and images in gallery shortcodes are automatically detected and copied over. Other images, in normal image links or embedded in shortcodes or page builder data require special handling. Exactly what kind of handling is necessary I can say more precisely in your case if you could e-mail me a Broadcast debug text of the post in question.

    2. Do I need an email address for you or should I post it here?? I have a link to the debug output. Is that OK to send or should I copy that page and send as text?
    3. My e-mail address is visible under the “contact” page in the menu. You can either send me the link to the debug file or as a text. Whichever is easier for you.

  10. Using Offload media to S3 bucket, when you send to many no images are found as the files exist in s3 and not in the local directory.

    Is there a function or something I can update to look at s3 replacing the lookup for the local path?

    1. There are two parts to this answer:

      1. If you wish to modify attachment information, hook into the threewp_broadcast_broadcasting_started action, and the $action->broadcasting_data->attachment_data array has the information from all of the found attachments, including URLs and file paths.

      2. The CDN Workaround has a “copy remote files” option that will download the images to each child blog and use internal WordPress functions to insert the media during broadcasting.

      I hope this answers your question somewhat.

  11. I’m using broadcast with a multisite network. When I broadcast a post to a child site it ends up on the wrong category and with no image. I´m using Network Media Library plugin.
    What´s wrong?
    1. I’m very skeptical of anything that says it shares media across the network, due to limitations in WordPress itself: media IDs are assigned on a per-blog basis.

      Where can I find this plugin you’re using so that I can test it out for myself?

    1. The plugin looks to modify how WordPress images work completely and it doesn’t follow the standard of requiring media to exist on each blog, with its own ID.

      I don’t see how the plugin would work with WordPress, let alone work with Broadcast.

      WordPress is, unfortunately, not made to share media, but expected media to exist on the same blog.

  12. Hi. When I broadcast a post to more than 1 child site the logo on the child sites is overwritten with the parent site logo. It doesn´t happen if the post is broadcast to only 1 child site.
    What can I do, please?

    PHP 7.3.14
    WP 5.3.2
    Divi/Extra 4.2.2

  13. Hello,

    First, thank you very much for creating an amazing plugin. We’ve purchased a Add-On pack to use some additional features.

    We are encountering an issue with posts that contain images from the Media Library. Any broadcasted posts with images are creating new database entries for the same image within the Media Library which makes it appear that there are multiple copies of the same image. If the post is updated, then another database entry is created. Any ideas on what could be happening here?

    1. Difficult to say without a debug text, but my first guess would be your Broadcast image handling settings: if you visit Admin > Broadcast > Settings tab > Misc subtab > Attachment settings, what is the setting? USE EXISTING or CREATE RANDOMIZED?

  14. Hi Edward :)

    Is it possible not to use the thumbnail of the featured image in the broadcasted content?

    Thank you!

    1. Sure. If you insert the image in a gallery shortcode or as an image. Images should be automatically detected and broadcasted.

      How are you inserting the featured image and it isn’t working for you?

    2. We are using the default WordPress featured image field, and when we broadcast the post, the copy is using a thumbnail which is pretty blurry while the original post looks good.
    3. There must be a reason for the thumbnail differing from the parent. Different thumbnail sizes in the settings? Thumbnail was generated by a plugin that is no longer active or doesn’t work on child images?

  15. Hello Edward,

    Thank you for this great plugin.

    I´m publish and broadcast posts and pages and the content goes ok, but.. won’t show the images, or show a different image.. I believe that the ID is not passed correctly.

    I want to know if the Elementor adds works because i´m using Elementor and Jet Engine Crocoblock for the Custom post Types

    Thanks

  16. Hi,
    I am facing the same problem like Stefan T.

    I have a Multi-Site on WordPress and I am using the ACF fields. One of the fields are an image field. The content will be copied to the child and the image will be stored in the media library but the link from the image to the post item is missing.

    Is there any setting which needs to be enabled?
    All other ACF fields are working perfect and I am very happy with the Broadcast plugin.
    I hope you can help me.
    Kind Regards
    Elke

  17. HI,

    when I broadcast a page using Divi Builder, the images from the Divi Builder aren’t transferred, the URLs remain from the parent page. Only if the image exists in the child media library, the URL in the image module gets changed. The Divi add-on is installed and activated.

    What can I do, please?

    1. The best way to diagnose such problems is to enable Broadcast debug mode, broadcast the post to one blog, and then send me the debug text to read through.

      Also, point out which images are incorrect, so I know what to look for.

    2. Thank you for the quick response. I’ve just sent the file via email.
  18. We have created custom blocks using ACF plugin and syncing the content to sub sites on multisite setup. All the ACF content gets broadcasted properly but the images added using ACF image field don’t. Can you give us a solution for this?

    Thanks,

    Aslam

    1. The images are not inside “Gutenberg” blocks as “Image” block but added inside ACF Image field which is used under a Block created using ACF Plugin. We tried Gutenberg Attachments add-on but it didn’t work.
    2. Then either the ACF add-on solves this problem or the custom field attachments add-on solves this problem, depending on how the image is stored.

      The ACF add-on handles normal, standard fields of all types specified in a field group and attached to a post. But your use case sounds more like the CFA add-on. If you send me a dump (Admin > Broadcast > Maintenance tab > view post info check) of the post and its custom fields, I can perhaps tell you.

    3. That definitely looks like the Gutenberg Attachments add-on should have worked.

      It’s probably just the add-on not correctly set up. Could you e-mail me and show me how you’ve set up the GA add-on? A screenshot from the overview should suffice.

    4. That’s for an image block, which you are not using. You are using a completely different block.

      The correct settings should be: name ct/three-column-cta

      and multiple ID: ctas_*_image

      Nothing in single ID.

  19. Hello. After a broadcast when using WPBakery Page Builder (Woodmart Theme & Plugin) extension, images are missing from the child page. What could be the solution?

Leave a Reply

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