Guide

Art Direction REST API

REST field on enabled post types plus a public get endpoint.

Auth summary

AccessSurface
PublicGET /wp-json/prc-api/v3/art-direction/get/{post_id}
Post edit capUpdate art_direction on wp/v2 post routes

REST field art_direction

Registered on each post type returned by Plugin::get_enabled_post_types().

OperationCapability
ReadVia standard post REST read rules; get callback runs API->get('all') and migrates legacy social keys
Updatecurrent_user_can( 'edit_post', $post->ID ); sanitizes slots; writes meta artDirection
GET  /wp/v2/posts/{id}   → response.art_direction
POST /wp/v2/posts/{id}   body: { "art_direction": { "A1": { … }, "social": { … } } }

GET /art-direction/get/{post_id}

Namespace: prc-api/v3
Permission: return true (public)
Callback: API( $post_id )->get( 'all' ) — full art direction object, or featured-image fallback when meta is empty.

Request GET /wp-json/prc-api/v3/art-direction/get/123
HeadersKey: value
Accept application/json
Response 200 OK
BodyJSON
{
  "A1": {
    "id": 456,
    "url": "https://example.org/a1.jpg",
    "chartArt": false
  },
  "social": {
    "id": 456,
    "url": "https://example.org/social.jpg",
    "chartArt": false
  }
}
Reference

Per-slot properties

Typed options, defaults, and constraints in one scannable reference.
7 fields
id number
Attachment ID.
rawUrl url
Uncropped source URL.
url url
Sized URL for the slot.
width number
Width in pixels.
height number
Height in pixels.
chartArt boolean
Light/chart background flag.
caption string
Optional caption.

Was this helpful?