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.

1 comment:

  1. I am very ecstatic when I am reading this blog post because it is written in a good manner and the writing topic for the blog is excellent.
    Thanks for sharing valuable information. Also get to know about Magento 2 Wordpress Integration Services

    ReplyDelete