List Posts From WordPress Using REST API With cURL In PHP

WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON (JavaScript Object Notation) objects. This enables developers to create, read and update WordPress content from client-side JavaScript or from external applications. Nowadays every application provides the API to interact with their application remotely or to share their data in another platform. Here, This article will shows a how to list posts from WordPress using REST API with cURL in PHP

WordPress provides various REST API methods to use WordPress in new and exciting ways, such as creating Single Page Applications on top of WordPress. You would not even have to write the applications in PHP: any programming language that can make HTTP requests and interpret JSON can interact with WordPress through the REST API, from Node.js to Java and beyond.

WordPress REST API To List Posts :

For listing posts from the WordPress REST API, WordPress provides the below endpoint,
GET /wp/v2/posts

With this endpoint you can get the lists of posts and we can also do manipulation on the response by passing the arguments on the endpoint like,

  • page
  • per_page
  • search
  • orderby
  • order

You can check on the WordPress Official REST API Handbook for more arguments that can be used on the URL.

Example Requests :
$ curl
$ curl

Source Code :

Code Snippet gets the list of posts from Niralar through cURL In PHP, Where your listing the posts outside the WordPress platform with your custom UI desing.

You can checkout the demo here

Please leave your valuable comments/suggestions/feedback on below comment box if any.

Thank You !!


SIVA SANKAR, Working as a Software Engineer, Blogging is my hobby. I completed my Bachelors of Engineering (Computer Science Engineering) in Chennai, India. and my Master of Engineering (Embedded System Technologies) in Tamilnadu, India.

2 thoughts on “List Posts From WordPress Using REST API With cURL In PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.