简体   繁体   English

Wordpress 防止私人帖子的 404 页面

[英]Wordpress Prevent 404 page for private posts

I have some private posts in my blog and I want the user to have the ability to view the posts or have a custom 404 page for those posts indicating they have to login to view it.我的博客中有一些私人帖子,我希望用户能够查看帖子或为这些帖子提供自定义 404 页面,表明他们必须登录才能查看。

Is this possible?这可能吗?

Thanks,谢谢,

If you don't already have a custom 404 page, simply generate the template file in your WordPress theme.如果您还没有自定义 404 页面,只需在您的 WordPress 主题中生成模板文件。

https://codex.wordpress.org/Creating_an_Error_404_Page https://codex.wordpress.org/Creating_an_Error_404_Page

Regardless of whether or not you are going to prompt users to log in to view your private posts or not, creating a 404 page that's styled to match your site's brand is strongly recommended.无论您是否要提示用户登录以查看您的私人帖子,强烈建议您创建一个风格与您网站品牌相匹配的 404 页面。

As for prompting users to log in to view your private posts, it is possible, but will require (either) some substantial theme customizations, or a 3rd party plugin.至于提示用户登录以查看您的私人帖子,这是可能的,但需要(要么)一些实质性的主题自定义,或一个 3rd 方插件。

Based on the requirements you described, here's a plugin that should do the trick:根据您描述的要求,这里有一个插件可以解决问题:

https://wordpress.org/plugins/lh-private-content-login/ https://wordpress.org/plugins/lh-private-content-login/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM