hi,
I have a page that calls my custom plugin. In this plugin I am trying to get the current page ID,
function hook_ajax_register() {
global $wp_query;
check_ajax_referer($this->nonce_key_register, '_wpnonce', true); // die on failure
// Get the form data
parse_str($_POST['data'], $data);
$thePostID = $wp_query->post->ID;
$this->ref_code = get_post_meta($thePostID, 'ReferenceID', true);
.....etc
}
If I change the post Id to a particular post(say 75) it works, however trying to retrieve the current post id where the plugin is called is not working!
Please help