跳到内容

shawesome Contextual 404 – Different 404 Pages by Post Type and URL

v1.0.0

shawesome · 2026年11月14日 上架

Shows a different 404 page depending on the requested URL: by post type, by taxonomy or by your own path rules.

正在使用
10 以下
评分
暂无
累计下载
146
最近更新
2026年11月15日
需要 WordPress 6.4+已测试到 7.1.5PHP 7.4+

贡献者

截图

Settings: a 404 page for every public post type and a default, path rules by prefix or regular expression, and the URL test showing which 404 page a URL gets.
Settings: a 404 page for every public post type and a default, path rules by prefix or regular expression, and the URL test showing which 404 page a URL gets.
404 Log: errors by category and the most frequent URLs, with a shortcut to a new path rule.
404 Log: errors by category and the most frequent URLs, with a shortcut to a new path rule.
The list of 404 pages with the column "Used for".
The list of 404 pages with the column "Used for".
Dashboard widget with the 404 errors of the current month.
Dashboard widget with the 404 errors of the current month.
Front end: the 404 page of a path rule for a shop URL.
Front end: the 404 page of a path rule for a shop URL.
Front end: the 404 page for posts.
Front end: the 404 page for posts.
Front end: the 404 page for pages.
Front end: the 404 page for pages.

A missing product should lead to the shop, a missing blog post to the blog. shawesome Contextual 404 shows the 404 page that fits the requested URL.

404 pages

Create 404 pages under shawesome Contextual 404 in the tab 404 Pages, with the block editor or with Elementor. The column Used for shows where each page applies. They use the page template of your theme, so the title is shown as a heading. They have no public URL and are not part of the sitemaps of WordPress.

Assign them

In the tab Settings you assign a 404 page to every public post type, and a default for everything else. For a request, the plugin checks in this order:

  1. Path rules – a prefix or a regular expression, in the order you entered them.
  2. Query vars – what the rewrite rules of WordPress recognized: a post type, a taxonomy of a post type, a date.
  3. URL prefixes – the rewrite slug or the archive of a post type, e.g. /shop/.
  4. Parent pages – URLs below an existing page belong to the post type Pages.
  5. Default – the page selected as the default, otherwise the 404 page of your theme.

With the permalink structure /%postname%/, posts and pages both live in the root. A URL such as /xyz does not reveal what was requested, so the default applies.

The field Test URL below the path rules shows which 404 page a URL would get, with the values not yet saved.

Search engines

The response keeps the status 404 and carries an X-Robots-Tag: noindex header. While the <head> is printed, WordPress reports a 404, so that SEO plugins handle the request as an error page.

Languages

404 pages can be translated with Polylang. Select a 404 page in any language, the plugin shows its translation in the current language. Language prefixes are not part of the paths in your rules. The language switcher leads to the home page of a language.

Statistics

The plugin counts 404 errors per month, by the path rule or post type that applied, otherwise as “Default”. A dashboard widget shows the current month as a bar by category, the tab 404 Log shows the last 12 months, together or one by one, with the most frequent URLs. Older months are deleted.

Only the path of a URL is stored, percent-encoded and without its query string, together with a counter. IP addresses, user agents and referrers are not stored. A month holds up to 1,000 rows; beyond that, new URLs are only counted by category. Requests answered by a page cache do not reach WordPress and are not counted.

Counting can be switched off in the tab Settings. The statistics can be deleted in the tab 404 Log.

For developers

  • Filter shawesome_c404_page_id – change the 404 page of a request.
  • Filter shawesome_c404_log_limit – change the number of rows a month holds.
  • Template single-shawesome_404.php in a theme – replaces the page template for 404 pages.
  • All callbacks are named functions and can be removed with remove_action() / remove_filter().

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums