描述
Bringing visitors to your website takes time and effort. Every visitor is important. The default 404 error page of most themes does not provide any information on what to find on your site. A first-time visitor, who does not know you, is left in a dead end and leaves your website. Set up a helpful custom 404 error page to keep them on your site!
这个方便的插件使您可以轻松创建自己的404错误页面,并且几乎适用于所有主题。
Out of Retirement!
NerdPress has adopted Smart Custom 404 Page! Read the announcement here.
We’ve been fans of this plugin for many years, and we’re grateful for Peter’s many years of service to the community. Peter retired from plugin development in October 2023, so we’ve jumped in to help ensure this plugin continues to work well now and in the future.
使用方法
Create your custom 404 error page just like any other page using the WordPress Editor (Pages > Add New
). Then go to Appearance > 404 Error Page
and select the created page as your custom 404 error page. That’s it!
为什么使用本插件?
Unlike similar plugins the 404page plugin does not create redirects. That’s quite important because a correct code 404 is delivered which tells search engines that the page does not exist and has to be removed from the index.
Additionally, the 404page plugin does not create additional server requests.
要求
The only requirement for this plugin is that you change the Permalink Structure in Settings > Permalinks
to anything else but “Plain.” This also activates the WordPress 404 error handling.
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
) - “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
- 本插件不收集或存储任何数据
- 本插件不会将任何数据发送到外部服务器
针对开发者
动作钩子
The plugin adds an action hook 404page_after_404
which you can use to add extra functionality. The exact position the action occurs after an 404 error is detected depends on the Operating Method. Your function must not generate any output. There are no parameters.
常量
If the 404page plugin is installed and activated it defines the PHP constant PP_404
. Check existence of it to detect the 404page plugin.
函数
本插件提供以下函数:
pp_404_is_active()
to check if there is a custom 404 page selected and the selected page existspp_404_get_page_id()
to get the ID of the 404 pagepp_404_get_all_page_ids()
to get an array of page IDs in all languagespp_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
评价
贡献者及开发者
更新日志
11.4.8 (2024-10-02)
- Address potential XSS vulnerability. Thanks to Webbernaut for responsible disclosure.
11.4.7 (2024-09-16) OUT OF RETIREMENT!
- NerdPress has adopted Smart Custom 404 Page! Read the announcement here.
- Tested up to WP 6.6
- Modernized direct file access protection and removed closing PHP tags
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)
- 针对Polylang(参阅主题)的错误修复
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)
- 针对bbPress的错误修复(参阅主题)
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)
- 初始发行