• graemep

    (@graemep)


    I have a page outside WordPress that displays some stuff from WP.

    I would like to restrict access to logged in users. Ideally I would like to return a 404 to anyone else. Is this possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kafkaesqui

    (@kafkaesqui)

    Yep. Just after where wp-blog-header.php is included (you are doing this at the start of the document, right?), add a bit of PHP to return a 404 to non-logged-in visitors:

    <?php
    include('./wp-blog-header.php');

    global $user_login;
    if(!$user_login) {
    header("HTTP/1.0 404 Not Found");
    exit;
    }
    ?>

    Thread Starter graemep

    (@graemep)

    Thread Starter graemep

    (@graemep)

    Thanks Kafkaesqui, done in seconds and working fine.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP login on page outside WP’ is closed to new replies.