mitcho / hookpress

HookPress
58 stars 57 forks source link

Add fields to hooks #10

Closed bullfight closed 1 year ago

bullfight commented 9 years ago

I'm interested in adding fields to publish_post and edit_post such as related objects like post_thumbnail and terms.

I have used the XMLRPC API in the past to request this attributes, but would like to have them sent along in a hook.

In this case I'm hoping to add what would effectively be nested attributes to the attribute array. This is an example of the type of data I would like to be able to add.

What would it take to add these? Or how could they be added?

"post_thumbnail": {
  "attachment_id": "24",
  "date_created_gmt": "2015-10-05 22:07:01",
  "parent": 19,
  "link": "https://foo.files.wordpress.com/2015/04/foo.jpg",
  "title": "foo",
  "caption": "",
  "description": "",
  "metadata": {
    "width": 1280,
    "height": 960,
    "file": "/home/wpcom/public_html/wp-content/blogs.dir/453/88434674/files/2015/04/foo.jpg",
    "sizes": [

    ],
    "image_meta": {
      "aperture": 2.4,
      "credit": "",
      "camera": "iPhone 5",
      "caption": "",
      "created_timestamp": 1424101192,
      "copyright": "",
      "focal_length": "2.18",
      "iso": "32",
      "shutter_speed": "0.0024271844660194",
      "title": "",
      "orientation": 1
    }
  },
  "thumbnail": "https://foo.files.wordpress.com/2015/04/foo.jpg?w=150"
}
"terms": [
  {
    "term_id": "1",
    "name": "Uncategorized",
    "slug": "uncategorized",
    "term_group": "0",
    "term_taxonomy_id": "1",
    "taxonomy": "category",
    "description": "",
    "parent": "0",
    "count": 6,
    "filter": "raw"
  }
]