accessing a global from an include
-
My wordpress post is at https://www.mydomain.com/wordpressfolder/permalink
My page is at https://www.mydomain.com/pagefolder/page.phpI have a php include on my page that incorporates my post into my page:
<?php include "https://www.mydomain.com/wordpressfolder/permalink/";?>
Login is required to add a comment to the post.
If you are logged in, and you go to the post directly, it shows you the ability to add a comment.
If you are logged in, and you go to my page (with the include of the post), it doesn’t think you’re logged in.
I’ve tested this by putting this code into the post (comments.php):
<?php global $user_ID; echo('User ID: ' . $user_ID); ?>
When logged in and you go directly to the post, it answers with the proper user ID: “User ID: 5”
When logged in and you go to my page, it has no answer – just says “User ID: “
So my question is how can I get my page to access the logged in user ID?
Thanks,
~marc
- The topic ‘accessing a global from an include’ is closed to new replies.