WordPress.org

Ready to get started?Download WordPress

Forums

Attach (not insert) image to multiple posts (10 posts)

  1. mary.a.s
    Member
    Posted 3 years ago #

    Greetings; just one more request for the ability to attach (not just insert) images to multiple posts. That is, the same image, uploaded once, with the ability to attach it to multiple posts. Thanks!

  2. No, images can only be attached to one post.

  3. Spokesrider
    Member
    Posted 3 years ago #

    I've just started to use Shiba Gallery and Shiba Media Library. I'm not sure why it's not available through the usual "add plugin" mechanism, but it seems to get around the problem satisfactorily, at least for my purposes. (Now if only I could get galleries of photos to orderby the EXIF date.)

    [sig moderated as per the Forum Rules]

  4. If a plugin dev doesn't add the plugin to the repository, it doesn't show up in 'Add Plugin' :)

    http://shibashake.com/wordpress-theme/super-wordpress-gallery-plugin

    http://shibashake.com/wordpress-theme/media-library-plus-plugin

  5. c_d_reilly
    Member
    Posted 2 years ago #

    No, images can only be attached to one post.

    Can anyone shed some light on the reason for the distinction between an image being attached vs inserted?

    Seems like a reasonable expectation to be able to, say, query all the images in a post (attached or inserted) for use in a plugin, or have '[gallery]' links that show all the images in a post.

    Maybe just something that has yet to be implemented, but still very curious...

  6. Seems like a reasonable expectation to be able to, say, query all the images in a post (attached or inserted) for use in a plugin, or have '[gallery]' links that show all the images in a post.

    The only way for [gallery] to be able to query what images are in a page is for them to be 'attached.' If they're inserted, there's no way for WordPress to dynamically generate things.

  7. c_d_reilly
    Member
    Posted 2 years ago #

    The only way for [gallery] to be able to query what images are in a page is for them to be 'attached.' If they're inserted, there's no way for WordPress to dynamically generate things.

    Correct, that's exactly the point which leads to my question above: why is there a distinction between attaching and inserting an image? Seems from a database perspective, it's trivial to track an image as being attached to multiple posts.

    Is there some other conflict elsewhere in WP that I'm unaware which would act up if images were attached to multiple posts? Or is this maybe an issue that hasn't happened to get developer attention yet? Thanks!

  8. michael.mariart
    Member
    Posted 2 years ago #

    The difference is that when an image is inserted, the only reference to it is the HTML code that's generated for that image, there's no actual link between the image and the post stored anywhere in the database. When the image is attached, there's a distinct link recorded so that the system can find these images to be displayed as a gallery. Because pretty much everything in WP is a varient of a post, there's only a single value available to record a parent into, so a image can only be attached to one post because.

  9. c_d_reilly
    Member
    Posted 2 years ago #

    Michael, thanks, I understand the mechanics of how attachments vs inserts work in the database; what I'm wondering is whether there's a practical reason for why WP is structured this way, or whether it was an arbitrary decision?

  10. Mikkel Breum
    Member
    Posted 2 years ago #

    WordPress ought to allow for one instance from the media library to be attached to several posts. With the current limitations, plugins that pull image attachments for a post or a custom post type such as an image slider, can't place the same image in multiple sliders/galleries. The only way to achieve this will be by uploading the same image multiple times. They will then get different id's and filenames, and they bloat the upload folder, require extra work if an image needs to be updated across the site, and finally it will generate higher costs for CDN users and less efficient caching.

    This is a severe design limitation in WordPress for CMS use cases.

    Often you'd want the same image to appear in different sliders/galleries, let's say you have a bookstore or car dealer, and you have your content categorized in some way, where it may be relevant to feature the same book or car in several categories.

    This should not require using multiple identical instances of the *same* media assets, uploaded as duplicate files with different names.

Topic Closed

This topic has been closed to new replies.

About this Topic