WordPress.org

Ready to get started?Download WordPress

Forums

How to make Attachement's post_parent to be array to support multiple parent? (2 posts)

  1. ringomamama
    Member
    Posted 1 year ago #

    Is there any ways to make Attachement's post_parent to be array to support multiple parent through hooks?

    Thus, finally could get where the attachments were attached to which posts.

    Thanks for any helps. thanks!

  2. bcworkz
    Member
    Posted 1 year ago #

    No, that field only accepts integers. Even if possible, it would probably break WP by inserting an array there.

    It appears the attachment post type only records the parent of it's first use, there is no way to discern any other uses from the attachment post data. To get an accurate count like you are looking for could involve querying the content of all posts for references, as well as post_meta for use as featured images.

    I'd be curious to hear any other ideas on how to get a list of posts using a particular media attachment, without building custom reference data.

Topic Closed

This topic has been closed to new replies.

About this Topic