Skip to main content

is404()

Description

Determines when a dynamic post, page, or category route is requested for which no corresponding WordPress post, page, or category exists.

See Expected URL Params for more on how dynamic routes are mapped to a specific page, post, or category in WordPress.

note

This function is only useful on routes that include one of the expected URL params. If none of the expected URL params are present in the provided context, is404() will always return true.

Parameters

  • Context: Either the GetStaticPropsContext or the GetServerSidePropsContext from Next.js, depending on which function you are resolving props from.
  • Is404Config: An object with a client property containing your GQty client.

Return

Returns true when the requested WordPress post, page, or category does not exist.

Usage

View the guide on Handling 404s with is404 for a detailed description and example code.