Loop: Attachment

For loop type attachment, here are the query parameters and fields.

Query parameters

  • author - Include by author ID, login name, or "current"

    Type: string, array

Fields

  • all - Show all custom fields (for development purpose)
  • alt - Image attribute alt
  • ancestors - Ancestor posts from lowest to highest level; Set reverse=true to go from top-level down
  • archive_author - On an author archive page: Current author as a user loop
  • archive_post_type - On a post type archive page: Current post type as a loop
  • archive_term - On a taxonomy archive page: Current taxonomy term as a loop
  • author - Author
  • author_* - Author's user field
  • caption - Caption
  • content - Content
  • description - Description
  • edit_url - Edit URL
  • excerpt - Excerpt
  • extension - File extension
  • filename - File name
  • id - ID
  • menu_order - Menu order
  • modify_date - Modify date
  • name - name/slug
  • post_class - Post classes
  • publish_date - Publish date
  • sizes - Responsive image attribute "sizes" for img tag - Accepts optional attribute "size" for image size name (default is "medium"), or width and height values in pixels separated by comma like "400,300"
  • srcset - Responsive image attribute "srcset" for img tag - Accepts optional attribute "size" for image size name (default is "medium"), or width and height values in pixels separated by comma like "400,300"
  • status - Status
  • title - Title
  • url - URL - Accepts optional attribute "size" for image size