Ryan McCue
Forum Replies Created
-
Forum: Plugins
In reply to: [WP REST API (WP API)] New post with imageTo clarify what’s been said above, uploading attachments is a separate step to setting a featured image. The documentation covers media creation, which is a two-step process: first, POST the image data to
/media, which will create the post; then, update the returned post with any necessary attachment post data. The first step will give you a Post entity which will include:{ "ID": 4, }As for setting this as the featured image on a post, you can then set this on a post via the
featured_imagevalue, which should be the image ID:{ "featured_image": 4, }Forum: Plugins
In reply to: [WP REST API (WP API)] Save/Edit a commentThis is not currently possible, sorry! We’re tracking this issue on GitHub as issue 86.
Forum: Plugins
In reply to: [WP REST API (WP API)] Cookie Authentiction with AngularjsYou’ll need to either send the
X-WP-Nonceheader, or the_wp_json_noncequery parameter with your request. You’ll need to generate this on the server withwp_create_nonce( 'wp_json' ), which you can then output on to the page for your script usingwp_localize_script.(This assumes you’re accessing the data from the site’s frontend, not from an external site.)
Forum: Plugins
In reply to: [WP REST API (WP API)] PagesYou should also be able to access pages at
/wp-json/pages, and you can access individual pages at/wp-json/pages/<id>or/wp-json/pages/<slug>Hope that helps!
Forum: Plugins
In reply to: [WP REST API (WP API)] Custom meta dataHey chirinyu,
Due to security/privacy concerns, custom meta is now only available to authenticated users. You’ll need to authenticate as a user, then pass
?context=editwith the request.If you need this data when unauthenticated, you can make a quick plugin to filter
json_prepare_postand add in the fields you’d like:add_filter( 'json_prepare_post', function ($data, $post, $context) { $data['myextradata'] = array( 'somekey' => get_post_meta( $post['ID'], 'abcdef', true ), ); return $data; }, 10, 3 );This data would then be available as the
myextradatakey in the post. πHope that helps!
Forum: Plugins
In reply to: [WP REST API (WP API)] Get multiple posts/media by IDYou should be able to do it with the
post__infilter:GET /posts?filter[post__in][]=1&filter[post__in][]=2&filter[post__in][]=3We’ve got a documentation ticket open for this too. π
Forum: Plugins
In reply to: [WP REST API (WP API)] Magento Fishpig WordPress Integration problemI am using the Fishpig integration of wordpress for Magento
I’m not sure on how this is integrated, however you basically want to hit the
/wp-json/rewrite in WordPress.According to your site’s RSD, the API should be available at http://www.iamalpham.com/index.php/topics/wp-json
However, it doesn’t appear to be. π I’d ask the developer of the integration how to access it.
Forum: Plugins
In reply to: [WP REST API (WP API)] Posting, returned errors errorVersion 0.9 has now been released; if you upgrade, you should see this now fixed. π
Forum: Plugins
In reply to: [WP REST API (WP API)] How to include Meta data fields in a PostThis is currently planned, but not yet implemented.
Forum: Plugins
In reply to: [WP REST API (WP API)] Excerpt returns false contentim using your plugin and remarked that the value of the excerpt for each post is always the value of the first post.
This might be caused by a misbehaving plugin changing the excerpt. What plugins do you have activated?
Forum: Plugins
In reply to: [WP REST API (WP API)] You can add functionality get_usermeta ?This is currently planned, but not yet implemented.
Forum: Plugins
In reply to: [WP REST API (WP API)] Retrieve Posts by Category ID or slugIs there any REST API for retriveing all the published posts from a specific category by category slug or category ID?
You can pass any parameters marked as public to
WP_Querythrough via thefilterparameter.In this case, you can do either
/posts?filter[cat]=12or/posts?filter[category_name]=my_cat_slugForum: Plugins
In reply to: [WP REST API (WP API)] php 5.3.x DateTime::createFromFormat()This has now been fixed and will be included in the next release, marking as resolved.
Forum: Plugins
In reply to: [WP REST API (WP API)] Retrieve all categories from a WP siteThanks Patrick. Closing as resolved.
Forum: Plugins
In reply to: [WP REST API (WP API)] Posting, returned errors errorThis should be fixed as of #50. Can you confirm please? π