Get current page id in custom plugin
-
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
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Get current page id in custom plugin’ is closed to new replies.