you can use $post->ID for current id.
You can get id through below Code...Its Simple and Fast
<?php $post_id = get_the_ID();
echo $post_id;
?>
Try:
$post = $wp_query->post;
Then pass the function:
$post->ID
global $post;
echo $post->ID;
In some cases, such as when you're outside The Loop, you may need to use get_queried_object_id()
instead of get_the_ID()
.
$postID = get_queried_object_id();
Source: Stackoverflow.com