ISR (Incremental Static Regeneration)

In production your Next.js site is deployed on a server (like Vercel). Every time a visitor loads a page, Next.js would normally call your WordPress API to get the posts. If you have 1,000 visitors, that’s 1,000 API calls to WordPress — which slows things down and puts load on your WordPress host.

With revalidate: 3600, Next.js instead:

  1. Fetches from WordPress once and caches the result
  2. Serves that cached response to all visitors for 1 hour — near-instant, no WordPress calls
  3. After 1 hour, fetches fresh data from WordPress and updates the cache This is called ISR (Incremental Static Regeneration) — you get the speed of a static site but content still updates
    automatically. The tradeoff: If you publish a new post, it won’t appear on the live site for up to 1 hour. You can fix this with the
    revalidation webhook we already built (/api/revalidate) — when WordPress publishes a post, it calls that endpoint and
    Next.js immediately refreshes the cache, so new posts appear in seconds rather than waiting an hour. You can also tune the number — revalidate: 60 means 1 minute, revalidate: 0 means no cache (always fresh, but slower). For
    a blog, 1 hour is a sensible default.

Comments

Leave a Reply

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