I haven't used the WP-API/JSON REST client plugin so far, but this is what I can see in source: The ~/js/models.js
is the entry point for all requests, it seems. And every of the wp.api.models
(to name a few: Page
, Post
, Media
, Revision
, etc.) is just an extension of Backbone.Model
.
And looking into the actual Post
model, I see that there seems to be a way to fetch post meta data as well:
defaults: function() {
return {
ID: null,
title: '',
status: 'draft',
type: 'post',
author: new wp.api.models.User(),
content: '',
link: '',
'parent': 0,
date: new Date(),
date_gmt: new Date(),
modified: new Date(),
modified_gmt: new Date(),
format: 'standard',
slug: '',
guid: '',
excerpt: '',
menu_order: 0,
comment_status: 'open',
ping_status: 'open',
sticky: false,
date_tz: 'Etc/UTC',
modified_tz: 'Etc/UTC',
terms: {},
post_meta: {}, // <---- USE THIS OBJECT
meta: {
links: {}
}
};
},
Link to Source
I don't know what exact object definition you used for
posts.fetch( options )
but you should give { post_meta : {} }
a try.
To (maybe) debug what you have access to, you could dump the arguments
in a callback attached to
var beforeSend = options.beforeSend;
which runs, of course, before the actual request gets fired. The "maybe" has its origin in that I was first looking at the gh-pages
branch per accident. There's nowhere stated what branch is used for what, so I assume that master
is the development and shipping branch (but who knows) and above might in that case not work.