WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add Media Library images to a post gallery (Backend?) (3 posts)

  1. Driftless
    Member
    Posted 5 years ago #

    I want to take photos that are already uploaded in my media library, and associate them with a post, so that I can include them in a "gallery."

    I know that if you are editing a post, and you upload photos, they will be included in a "Gallery" for that post, so that mus mean that they are tagged somehow in the database: either as "Post## is associated with picutureX, pictureY, pictureZ" or "PictureX is associated with Post##"

    Can anybody point me to where in the database this association is listed, so that I can change it directly in the database, thereby fooling WordPress into thinking those pictures were uploaded from a the particular post I now want to include them in (as a gallery)?

    Clear as mud?

    Thanks!

    (I've searched the forum, and have not found a satisfactory answer)

  2. Driftless
    Member
    Posted 5 years ago #

    Okay - found it out me-self... I'll post the solution here, since I know others have had this question.

    The key is that Pictures are logged in the POSTS table with their own Post 'ID' number, and are linked to the post or page with the 'post_parent' field.

    I found the pictures I wanted in the database, and changed their 'post_parent' field to the number of the post or page I wanted to insert the gallery into, and it worked like a charm.

    (Of course, this only works to have the picture in one gallery at a time, and if you change that 'post_parent' from a page where the picture is already living, it won't show up there anymore...)

    Hope people find this useful.

  3. mattoid
    Member
    Posted 5 years ago #

    Thanks...I always appreciate people who post solutions to their problems! Worked great for me!

Topic Closed

This topic has been closed to new replies.

About this Topic