• Is there a way to check if protect the children’s user is logged in? I’d like to only show a link to the protected content if the user is logged in. WordPress

    if ( is_user_logged_in() ) {
        echo '<a href="">Some Link</a>';
    }

    doesn’t seem to work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter csatterwhite2010

    (@csatterwhite2010)

    Any help with this?

    I want to add a button to the home page once protect the children’s pages have been accessed to allow users to get back to the protected pages (they’re hidden from normal users).

    Plugin Author Matt Miller

    (@millermedianow)

    Hi! Thanks for the question and sorry for the delay in getting back to you.

    I suppose you have a couple options. There is a great plugin called ‘If Menu’ we use to only show users a menu item if they are logged in (for example):

    https://www.ads-software.com/plugins/if-menu/

    If you wanted to get more sophisticated, the conditional to check if a post has a post_password set would allow you to create conditionals around those actual page within the loop. For example:

    if(!empty($post->post_password)){
    // do some stuff
    }

    With our plugin enabled, this should return true for whether the page has a password on it or not even if it is being protected by it’s parent page.

    Let me know if that helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If Is Logged In’ is closed to new replies.