简体   繁体   中英

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.

Is this possible?

Thanks,

If you don't already have a custom 404 page, simply generate the template file in your WordPress theme.

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.

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.

Based on the requirements you described, here's a plugin that should do the trick:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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