I’m trying to have a page outside of WordPress use the is_user_logged_in function to determine if they can view some data or not. I am definitely logged in and the paths to the WordPress files are correct. Anyone have any thoughts why I can’t see the data?
<?php
error_reporting(E_ALL);
include('../blog/wp-load.php');
include('../blog/wp-blog-header.php');
if(is_user_logged_in()) {
//Do Something
} else {
echo 'Not logged in';
}
?>
I used require instead of include and your code is perfect now.