WordPress.org

Forums

get_attachments by category (4 posts)

  1. deepbevel
    Member
    Posted 2 years ago #

    Is it possible to pass get_attachments the name of a category instead of a post?
    Any references?

    Thanks

  2. wdfgea
    Member
    Posted 2 years ago #

    i am facing the same kind of issue. is there anyone out there who might know? ;)

  3. deepbevel
    Member
    Posted 2 years ago #

    for me, most of the answer was in a plugin called media categories. Attachments don't have categories by default, so the plugin adds the category taxonomy to media attachments.

    This idea was confusing for me, why can an attachment have an associated post id, but not a post category, or post meta?

    I only wanted to show the author of the attachment with the image.
    But first, there has to be a post, so there can be a way to output an author..
    As such, I had to use media categories in a way where I first get the posts and meta, then pull the attachments from those posts, and output attachments with the associated post meta.

  4. deepbevel
    Member
    Posted 2 years ago #

    As such, I had to use media categories in a way where I first get the posts and meta, then pull the attachments from those posts, and output attachments with the associated post meta.

    that actually is default wp behavior, and nothing to do with media categories.
    However, the ability to filter attachments per post by category, is what the plugin added that allowed me to acheive my goal.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.