Next.js plugin allows you to purge & re-build the cached pages from the WordPress admin area. It also automatically purges & re-builds when a page/post/... is saved or updated.
The revalidation request will be sent to the configured URL endpoint with two query arguments.
- The relative
path
to revalidate - The
secret
to protect the revalidation endpoint.
https://example.com/api/revalidate?path=/hello-world/&secret=my-super-secret-string
Based on the Next.js On-demand revalidation documentation
- Requires PHP 7.4+
- Requires WordPress 5.0+
Allows to purge & re-build aby URL. Return a boolean to indicate whether the purge has been successful.
nextjs_revalidate_purge_url( $url );
Name | Type | Description |
---|---|---|
url | string | The URL to purge |
Schedule a URL purge from Next.js cache. Will triggers a revalidation of the given URL at the given date time. Returns a boolean tp indication whether the schedule is registered.
nextjs_revalidate_schedule_purge_url( $datetime, $url );
Name | Type | Description |
---|---|---|
datetime | string | The date time when to purge |
url | string | The URL to purge |