I am trying to find a solution to a problem that WordPress seems to lack.
Here is a scenario:
I have uploaded images to a post using the native gallery to display the images. These images then appear under the gallery tab within the upload/insert and they will appear on the post. Works perfectly.
Further down the line I create a new post, I want to include images from my Media Library into the gallery without re-uploading the same images again.
I expected to find, “Insert into gallery”, next to “Insert into post”, but there doesn’t seem to be a way of doing this.
Is there a solution to this? I have done a lot of theme development in the past, but amazed at there isn’t a simple solution to this problem.
I would be grateful for any help.
Attachments are a type of post, and a post can only have a single parent, that’s why it’s not natively possible to have an attachment associated with multiple posts- there is no mechanism for many-to-many associations. There are several ways to solve this, but how simple it is depends on your skill level or willingness to depend on plugins.
For plugins, there’s File Gallery, and Advanced Custom Fields, probably others. Otherwise a couple of custom solutions would be to use post meta data to store references to attachments for a post, and/or a taxonomy to “tag” images for each unique gallery you want them associated with along with some meta data for ordering them.
Here is a thread on WordPress Hackers with an explanation from the lead developer and some possible solutions.