Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WP API (JSON REST API) at WordCamp Hampton Roads
Search
Nikhil Vimal
October 17, 2015
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WP API (JSON REST API) at WordCamp Hampton Roads
Nikhil Vimal
October 17, 2015
More Decks by Nikhil Vimal
See All by Nikhil Vimal
Utah WordPress Meetup talk (June 2015)
techvoltz
1
410
WordCamp Miami 2015
techvoltz
0
220
The awesome guide to contributing to WordPress
techvoltz
2
240
Getting started with WordPress development
techvoltz
0
80
WordSesh 2 Creatively Creating Custom Post Types
techvoltz
0
270
Creatively Creating Custom Post Types
techvoltz
0
89
Other Decks in Programming
See All in Programming
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.5k
Go 1.27 における memory allocation の高速化
andpad
0
120
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
1
1.5k
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
210
yield再入門 #phpcon
o0h
PRO
0
1k
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
370
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
150
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
150
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
160
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
610
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
490
Featured
See All Featured
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Between Models and Reality
mayunak
4
390
A Modern Web Designer's Workflow
chriscoyier
698
190k
Test your architecture with Archunit
thirion
1
2.3k
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
Faster Mobile Websites
deanohume
310
32k
WENDY [Excerpt]
tessaabrams
11
39k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
A Tale of Four Properties
chriscoyier
163
24k
So, you think you're a good person
axbom
PRO
2
2.1k
Transcript
Demo Time!
POST, PUT, DELETE, GET The WP API with Nikhil Vimal
Hi! I’m Nikhil V. I’m 16 and I build stuff.
http://v2.wp-api.org/
None
None
https://github.com/WP-API/WP-API
REST? RESTFUL? SLEEP?
Representational state transfer
Something…Something…HTTP
None
None
POST
DELETE
PUT
GET
/wp-json ?
NOPE!
None
/wp-json/wp/v2/posts
$.ajax({ method: "post", url: ‘http://local.dev/wp-json/ wp/v2/posts', data: data, beforeSend: function
( xhr ) { xhr.setRequestHeader( 'X-WP-Nonce', POST_SUBMITTER.nonce ); }, success : function( response ) { console.log( response ); alert( POST_SUBMITTER.success ); }, fail : function( response ) { console.log( response ); alert( POST_SUBMITTER.failure ); } });
So…why does this matter to me?
With great power comes great…
<?php function my_rest_prepare_post( $data, $post, $request ) { $_data =
$data->data; $thumbnail_id = get_post_thumbnail_id( $post->ID ); $thumbnail = wp_get_attachment_image_src( $thumbnail_id ); $_data['featured_image_thumbnail_url'] = $thumbnail[0]; unset($_data['featured_image']); $data->data = $_data; return $data; } add_filter( 'rest_prepare_post', 'my_rest_prepare_post', 10, 3 );
Please Mr. Postman
Slack + WordPress
None
wp.posts().post({ content_raw: 'my content’, title: ‘look at me go’ })
Custom Dashboards!
None
Authentication…UGH
None
http://www.sitepoint.com/wp-api-and- oauth-using-wordpress-without- wordpress/
None
add_filter('rest_enabled', '__return_false');
Fin @TechVoltz