Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

password protect a dynamic page?

$
0
0

Replies: 0

I have a directory and was able to password protect all the pages set up except the directory single listing page which is dynamic and uses single() and has a designated url: /listing/*

Is it possible to also password protect these individual pages? Maybe a function? I tried this code but it’s looking for actual WP logins and redirects if you are not an admin.

if ( is_single()  &&  ! is_user_logged_in() ){
    wp_redirect( site_url( '/directory_listings/' ) );
    exit();
}

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 59525

Trending Articles