Smart Custom 404 error page [404page]

描述

将访问者带到您的网站上既费时又费力。每个访客都很重要。但大多数主题的默认404错误页面缺乏有关您的站点的信息。这使得那些首次访问的访客感到困惑,并最终离开您的站点。应该设置有帮助的自定义404错误页面,以保留这些访客。

这个方便的插件使您可以轻松创建自己的404错误页面,并且几乎适用于所有主题。

Retired Plugin

Development, maintenance and support of this plugin has been retired in october 2023. You can use this plugin as long as is works for you.

There will be no more updates and I won’t answer any support questions. Thanks for your understanding.

Feel free to fork this plugin.

Thanks

Many thanks to the more than 100,000 users of this plugin. You have made this plugin a huge success. It was a pleasure and an honor, but I am retiring from plugin development.

Best regards,
Peter

使用方法

像创建其他页面一样,使用WordPress页面编辑器创建您的自定义404错误页面。然后转到“外观”-> “ 404错误页面”,选择创建的页面作为您的自定义404错误页面。大功告成!

为什么使用本插件?

与其他类似的插件不同,404page插件不会创建重定向,这 非常重要,因为这会传递正确的404代码,从而告诉搜索引擎该页面不存在,必须将其从索引中删除。

与其他类似的插件不同,404page插件不会产生额外的服务器请求

要求

运行此插件的唯一要求是,将“设置”->“固定链接”中的永久固定结构更改为除“朴素”以外的任何形式。这也会激活WordPress 404错误处理。

Block & Shortcode

Block

The Plugin offers a block “URL causing 404 error” for the block-based editor to show the URL that caused the error. The block offers three display options:

  • “Page” to show the page including path ( e.g. does/not/exist )
  • “Domain Path” to show the URL without protocol and parameters ( e.g. example.com/does/not/exist )
  • “Domain Path” to show the URL without protocol and parameters ( e.g. example.com/does/not/exist )
  • “Full” to show the complete URL ( e.g. https://example.com/does/not/exist?p=1 )

Shortcode

The Plugin offers a shortcode “pp_404_url” for the classic editor to show the URL that caused the error. There are three possible options:

  • [pp_404_url page] to show the page including path ( e.g. does/not/exist )
  • [pp_404_url domainpath] to show the URL without protocol and parameters ( e.g. example.com/does/not/exist )
  • [pp_404_url] or [pp_404_url full] to show the complete URL ( e.g. https://example.com/does/not/exist?p=1 )

插件隐私信息

  • 本插件不设置cookies
  • 本插件不收集或存储任何数据
  • 本插件不会将任何数据发送到外部服务器

针对开发者

动作钩子

该插件添加了一个动作钩子 404page_after_404,您可以使用它来添加其他函数。在检测到404错误后,动作发生的确切位置取决于操作方法。您的函数不应产生任何输出。没有参数。

常量

安装并激活404page插件后,它将定义PHP常量PP_404。可以通过检查这个常量是否存在以检测404page插件。

函数

本插件提供以下函数:

  • pp_404_is_active() 检测是否选择了一个自定义404页面并确认页面是否存在
  • pp_404_get_page_id() 获取404页面的ID
  • pp_404_get_all_page_ids() 获取包含所有语言的页面ID的数组
  • pp_404_get_the_url( $type ) to get the URL that caused the 404 error
    • Parameter $type string Optional
    • “page” to get the page including path ( e.g. does/not/exist )
    • “domainpath” to get the URL without protocol and parameters ( e.g. example.com/does/not/exist )
    • “full” (default) to get the complete URL ( e.g. https://example.com/does/not/exist?p=1 )

原生模式

If you are a theme developer you can add native support for the 404page plugin to your theme for full control.

区块

该插件提供了1个区块.

  • URL causing 404 error

评价

2024 年 1 月 26 日
This plugin does exactly what I need to create an effective 404 error page
2023 年 10 月 5 日
Hello Peter, I want to thank you for the use of this lovely, simple plugin. Am sad that you are retiring from supporting it, it will be hard to replace, but I understand life changes. Just wanted to wish you the best in your life and future endeavors! With Appreciation Alannah
阅读所有1,183条评价

贡献者及开发者

“Smart Custom 404 error page [404page]” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

「Smart Custom 404 error page [404page]」插件已被翻译至 18 种本地化语言。 感谢所有译者为本插件所做的贡献。

将“Smart Custom 404 error page [404page]”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

11.4.6 (2024-04-17) URGENT BUGFIX

  • Bugfix after Cleanup

11.4.5 (2024-04-16) CLEANUP

  • Cleanup

11.4.4 (2022-10-05) FINAL VERSION

  • removed all links to webiste
  • removed request for rating
  • removed manual

11.4.3 (2022-11-05)

  • bugfix for WP 6.1

11.4.2 (2022-11-01)

  • also add class error404 to body tag if page is called directly
  • plugin renamed

11.4.1 (2022-10-16)

  • bugfix: load Javascript for Block only when needed

11.4.0 (2022-10-13)

  • Block added
  • Shortcode added
  • Function pp_404_get_the_url() added

11.3.1 (2022-04-05)

  • just cosmetics
  • Plugin Foundation updated to PPF08

11.3.0 (2021-01-06)

  • 添加总是发送410而非404错误的新选项
  • Plugin Foundation updated to PPF07

11.2.6 (2020-08-23)

  • 插件框架更新到PPF06

11.2.5 (2020-08-22)

  • 用户界面小幅优化

11.2.4 (2020-08-16)

11.2.3 (2020-07-05)

11.2.2 (2020-03-28)

  • 更改通知以实现更好的兼容性
  • 插件框架切换到PPF04

11.2.1 (2020-01-04)

  • 如果安装了W3 Total Cache并且缓存处于启用状态,则导致404错误的URL将自动从缓存中排除

11.2.0 (2020-01-01)

  • 如果安装了WP Super Cache并且缓存处于启用状态,则导致404错误的URL将自动从缓存中排除

11.1.4 (2019-12-29)

  • PPF03的紧急错误修复

11.1.3 (2019-12-29)

  • 插件框架更新到PPF03,没有功能性改变

11.1.2 (2019-11-19)

  • 从Jetpack生成的XML站点地图中排除404页面

11.1.1 (2019-11-16)

  • 从现在开始,不仅会检测Yoast SEO插件是否处于启用状态,还会检测站点地图功能是否已激活

11.1.0 (2019-11-10)

  • 现在使用PPF02插件框架来实现插件兼容性
  • 为开发人员引入了两个新函数 pp_404_get_page_id() 和 pp_404_get_all_page_ids()

11.0.5 (2019-10-22)

  • 针对Yoast SEO XML站点地图的错误修正(参阅主题
  • 如果Yoast SEO处于启用状态,则在设置页面中添加注释

11.0.4 (2019-10-06)

  • 针对WPML的错误修正

11.0.3 (2019-09-01)

  • 针对REST API调用的错误修正(参阅这里

11.0.2 (2019-08-30)

11.0.1 (2019-08-13)

  • 针对PHP7.1的错误修复 ——子类中的__construct()访问级别——这是一个PHP错误,已在PHP 7.2中修复,但是我将代码更改为也可与PHP 7.1一起使用

11.0.0 (2019-08-13)

  • 基于我新创建的插件框架重写大部分

10.5 (2019-04-01)

  • 一些安全方面的改进

10.4 (2019-03-31)

  • 修复了AJAX调用中的安全漏洞(感谢Julio Potier为我指出了这一点)

10.3 (2019-02-21)

  • 修复与iThemes Sync的兼容性(主题

10.2 (2019-02-19)

  • 小修复,以防止版本10出现潜在问题

10.1 (2019-02-14)

10 (2019-02-14)

  • WordPress固定链接错误的解决方法#46000
  • 代码优化
  • 性能优化

9 (2019-01-24)

  • 添加古腾堡注释

8 (2019-01-11)

  • 修复了与WPML最新版本的兼容性问题
  • 代码优化
  • UI优化

7 (2018-07-16)

  • 纠正错误的图像路径
  • 在管理页面添加视频链接
  • 核心优化

6 (2018-06-18)

  • 从Yoast SEO生成的XML站点地图中排除404页
  • 进一步的UI改进

5 (2018-03-05)

  • 如果当前编辑的页面是404错误页面,则显示一个指示器
  • 小幅代码及UI优化

4 (2018-03-05)

3.3 (2017-11-16)

  • 添加对从右到左语言的支持
  • WP 4.9中的错误显示已修复

3.2 (2017-10-05)

  • 新功能:向已删除对象发送HTTP 410错误

3.1 (2017-07-24)

  • 针对Polylang的错误修复(参阅主题
  • 针对CLI的错误修复(参阅主题
  • 将debug类添加到body标签
  • 还为Customizr主题添加body类
  • 不重复添加已存在的error404类
  • 进一步重新设计管理界面

3.0 (2017-07-05)

  • 新功能:加载页面后强制404错误
  • 新功能:禁用URL自动更正猜测
  • 最终删除了2.4中禁用的Polylang内容
  • 重新设计的管理界面
  • 代码优化

2.5 (2017-05-19)

  • 在前端的搜索结果中隐藏404页(如果WPML处于活动状态,则所有语言都将被隐藏)
  • 如果DW Question & Answer plugin by DesignWall处于启用状态并且问题没有答案,则不要在兼容模式下触发404

2.4 (2017-03-08)

  • 确保所有核心文件都被正确加载(参阅主题
  • Polylang插件不再依赖兼容模式(参阅主题
  • 如果安装了WPML并且“隐藏404页面”处于活动状态,则隐藏所有翻译(感谢WPML的各位指出这一点)
  • 发布状态修复(参阅主题
  • Enfold theme问题修复(感谢来自Kriesi.at的各位的帮助)

2.3 (2016-11-21)

  • 一些小的错误修正以修复某些页面模板组合中的问题

2.2 (2016-09-26)

  • 删除了针对几个插件自动切换到兼容模式的功能
  • 增强了对WPML和Polylang的支持
  • 从搜索结果中删除404页面(如果使用WPML或Polylang,则适用于所有语言)
  • 从站点地图或其他页面列表中删除404页面(如果使用WPML或Polylang,则适用于所有语言)
  • 作者归档的错误修正
  • 令人困惑的管理员消息已删除

2.1 (2016-04-22)

  • 引入可选操作方法
  • 对兼容性模式进行了几处更改,以提高WPML和bbPress以及Page Builder by SiteOrigin的兼容性
  • Polylang兼容性
  • 如果检测到由WPML、bbPress、Polylang或Page Builder by SiteOrigin,则自动切换到兼容模式
  • 全新的Customizr兼容模式(如果检测到Customizr,则自动启用)
  • 现在可以停用直接访问404错误页面时触发404错误的功能
  • 支持WP Super Cache
  • 添加从页面列表中隐藏404错误页面的选项
  • 404错误测试
  • 通过动作扩展插件
  • 卸载时的删除所有设置

2.0 (2016-03-08)

  • WPML兼容性
  • bbPress兼容性
  • Customizr兼容性
  • 直接访问404错误页面现在会引发404错误
  • error404类添加到分配给body HTML元素的类中
  • 设置菜单从“设置”移至“外观”
  • 删除了翻译文件,仅使用GlotPress

1.4 (2015-08-07)

  • 直接从设置页面编辑404页面
  • 葡萄牙语翻译

1.3 (2015-01-12)

  • 技术改进(改写为类)
  • 美化

1.2 (2014-07-28)

  • 西班牙语翻译
  • 塞尔维亚语-克罗地亚语翻译

1.1 (2014-06-03)

  • 添加多语言支持
  • 德语翻译

1.0 (2013-09-30)

  • 初始发行