Leave a Reply

96 Comments on "WordPress REST API Tutorial (Real Examples)"

Notify of
avatar

Harshal Phade
Guest
Harshal Phade
1 day 15 hours ago

Congrats Sir! Crossed 100k subscriber's just now😎 Hope to see you making new tutorials soon 🙂

Saggy The Creator
Guest
Saggy The Creator
4 days 21 hours ago

i am not getting wp-json folder. Showing incorrect path. any idea?

Rohit Savaj
Guest
Rohit Savaj
5 days 20 hours ago

hello nice tutorial,my question is "how to retrieve more then 10 posts??"

Caleb Prenger
Guest
Caleb Prenger
11 days 10 hours ago

What would be a better tutorial is how to sign in the user from maybe something like a cordova app? otherwise the wp api is useless

Abdul Ghani
Guest
Abdul Ghani
14 days 21 hours ago

never skip your ad man

Jubair Hossain
Guest
Jubair Hossain
18 days 21 hours ago
My code not working .. please help me anyone(function( $ ) { "use strict"; var quickAddButton = document.querySelector("#quick-add-button");if(quickAddButton){ quickAddButton.addEventListener("click", function(){ var ourPostData = { "title": document.querySelector('.admin-quick-add [name="title"]').value, "content": document.querySelector('.admin-quick-add [name="content"]').value, "status": "publish" }; var createPost = new XMLHttpRequest(); var magicalData=''; createPost.open("POST", "localhost/wordpress/wp-json/wp/v2/posts"); createPost.setRequestHeader("X-WP-Nonce", magicalData.nonce); createPost.setRequestHeader("Content-type", "application/json;charset=UTF-8"); createPost.send(JSON.stringify(ourPostData)); createPost.onreadystatechange = function(){ if(createPost.readyState == 4){ if(createPost.status == 201){ document.querySelector('.admin-quick-add [name="title"]').value=''; document.querySelector('.admin-quick-add [name="content"]').value=''; }else{ alert("Error- Try Again"); } } }; });};})( jQuery );//function.php codewp_enqueue_script('cus-main', get_theme_file_uri( '/assets/js/cus-main.js' ), array( 'jquery' ), '1.0', true );wp_localize_script( 'cus-main', 'magicalData', array( 'nonce' => wp_create_nonce('wp_reset') ));//Html code<div class="admin-quick-add"> <h3>Quick Add post</h3> <input type="text" name="title" placeholder="Title"> <textarea name="content" placeholder="Content"></textarea> <button… Read more »
Nyein Aung
Guest
Nyein Aung
21 days 3 hours ago

You forgot to say that "we need to change permalink setting to post name", so we can use rest api.. Because of this missing point, I wasted a day to fix this rest api problem…Keep your mind next time.

John Hoecker
Guest
John Hoecker
22 days 12 hours ago

Man, i know very little about json, ajax, and js, but this i could follow and learn how to tinker with (with additional study of course).

Will Fang
Guest
Will Fang
28 days 5 hours ago

Great video and clear explanation!

Bucur Ion Niculae
Guest
Bucur Ion Niculae
28 days 23 hours ago

Nice video. I like it. Ten plus for me to you…

1 2 3 9
wpDiscuz