WordPress · Schema

MediaItem

A WordPress media attachment object

CMSContent ManagementOpen SourceWordPress

Properties

Name Type Description
id integer Unique identifier for the media item
date string The date the media was uploaded
status string A named status for the object
type string Type of Post for the object
mime_type string The MIME type of the attachment
title object
alt_text string Alternative text to display when attachment is not displayed
source_url string URL to the original attachment file
media_type string Attachment type (image, video, audio, etc.)
media_details object Details about the media file including sizes
View JSON Schema on GitHub

JSON Schema

wordpress-media-item-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-media-item-schema.json",
  "title": "MediaItem",
  "description": "A WordPress media attachment object",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "Unique identifier for the media item",
      "example": 45
    },
    "date": {
      "type": "string",
      "format": "date-time",
      "description": "The date the media was uploaded",
      "example": "2026-03-10T09:00:00"
    },
    "status": {
      "type": "string",
      "description": "A named status for the object",
      "example": "inherit"
    },
    "type": {
      "type": "string",
      "description": "Type of Post for the object",
      "example": "attachment"
    },
    "mime_type": {
      "type": "string",
      "description": "The MIME type of the attachment",
      "example": "image/jpeg"
    },
    "title": {
      "$ref": "#/components/schemas/RenderedContent"
    },
    "alt_text": {
      "type": "string",
      "description": "Alternative text to display when attachment is not displayed",
      "example": "A sample photo"
    },
    "source_url": {
      "type": "string",
      "description": "URL to the original attachment file",
      "example": "https://example.com/wp-content/uploads/2026/03/photo.jpg"
    },
    "media_type": {
      "type": "string",
      "description": "Attachment type (image, video, audio, etc.)",
      "enum": [
        "image",
        "file"
      ],
      "example": "image"
    },
    "media_details": {
      "type": "object",
      "description": "Details about the media file including sizes",
      "properties": {
        "width": {
          "type": "integer",
          "example": 1920
        },
        "height": {
          "type": "integer",
          "example": 1080
        },
        "file": {
          "type": "string",
          "example": "2026/03/photo.jpg"
        }
      }
    }
  }
}