I'm in a page (NOT a post) and am trying to retrieve the Page ID using some embedded PHP in the page (using a PHP exec plugin). So far I've tried:
<?php echo "pageid: ".$page->ID; ?>
$page->ID returns empty, but using:
$post->ID returns empty too,
$get_the_ID() instead causes an error and stops execution,
$the_ID() ditto above,
$wp_query->post->ID returns empty, and finally:
$this_page_id = get_query_var('page_id'); echo "pageid: ".$this_page_id; ?>
returns "pageid: 0"
Any ideas what I could be doing wrong?