Wednesday, 30 May 2012

How to get current page id title slug in wordpress

$post_obj = $wp_query->get_queried_object();
echo $post_ID = $post_obj->ID;
echo $post_title = $post_obj->post_title;
echo $post_obj->post_name;

If you want to get more information about current page,use print_r like this
print_r($post_obj)

Hope this helps you.

No comments:

Post a Comment