How to purge the WP-API:

If you are using a cache for WordPress and want to include the WP-API, you'll have to invalidate it when a post is published or edited.

This is the list of urls you need to invalidate when a POST X is published or edited:

POST X:

https://blog.com?rest_route=/wp/v2/posts/X&_embed=true

LATEST POST, from the page where POST X is located (for example 3):

https://blog.com?rest_route=/wp/v2/posts&_embed=true&page=3&per_page=10
https://blog.com?rest_route=/wp/v2/posts&_embed=true&page=4&per_page=10
https://blog.com?rest_route=/wp/v2/posts&_embed=true&page=5&per_page=10
and so on...

Important: The URL of the frontpage is
https://blog.com?rest_route=/wp/v2/posts&_embed=true&page=1&per_page=10

CATEGORIES (for example Y) containing POST X, from the page where POST X is located (for example 7):

https://blog.com?rest_route=/wp/v2/posts&_embed=true&categories=Y&page=7&per_page=10
https://blog.com?rest_route=/wp/v2/posts&_embed=true&categories=Y&page=8&per_page=10
https://blog.com?rest_route=/wp/v2/posts&_embed=true&categories=Y&page=9&per_page=10
and so on...

TAGS (for example Z) containing POST X, from the page where POST X is located (for example 1):

https://blog.com?rest_route=/wp/v2/posts&_embed=true&page=1&per_page=10&tags=Z
https://blog.com?rest_route=/wp/v2/posts&_embed=true&page=2&per_page=10&tags=Z
https://blog.com?rest_route=/wp/v2/posts&_embed=true&page=3&per_page=10&tags=Z
and so on...


Other useful considerations:

results matching ""

    No results matching ""