Quantcast
Channel: Topic Tag: error | WordPress.org
Viewing all articles
Browse latest Browse all 31820

ajcke on "Page visibility private displays 404 error"

$
0
0

When a user who is not logged in navigates to a page that is marked private they receive a 404 error page. I'd like the page to display a kind reminder to please login to view this page.

I tried adding the following to the page loop, but a non logged in user still gets the 404 error page.

if ($post->post_status == "private" && !is_user_logged_in()) {
    echo "You must be logged in to view this page.";
} else if( $post->post_status == "private" && is_user_logged_in() ) {
    // Page code goes here
}

Viewing all articles
Browse latest Browse all 31820

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>