You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Héctor Cabrera edited this page Jun 24, 2024
·
5 revisions
With the release of version 4.7, WordPress -finally- introduced its very own REST API:
Content endpoints provide machine-readable external access to your WordPress site with a clear, standards-driven interface, paving the way for new and innovative methods of interacting with sites through plugins, themes, apps, and beyond.
WordPress Popular Posts (4.1+) provides its own REST API endpoints so you can display your popular entries on your (web) application.
/
Get links to all other endpoints available in the API.
HTTP method: GET
URLs:/wp-json/wordpress-popular-posts/v1/ and /wp-json/wordpress-popular-posts/v2/
When using the value “custom” in conjunction with the parameters time_unit and time_value (see below) you can retrieve popular posts from a custom defined time range (eg. last 12 hours).
Note that to send a POST request to this endpoint you must provide a valid nonce called '_wpnonce' either via the _wpnonce parameter or the X-WP-Nonce request header, otherwise the REST API will return an HTTP 401 Forbidden response.