How to get current page id in wordpress?

For getting the current page or post id in wordpress try with this
<?php
$post_id = $wp_query->post->ID;
echo  $post_id;
?>
  will displays the current page or post id













0 comments:

Post a Comment