get current page id in wordpress

$this_page_id = get_query_var('page_id')

In index.php etc. page is


$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");

get current page conetnt

$this_page_id = get_query_var('page_id');
$page_id = $this_page_id; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.
$page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. 

//echo "AAAAA";
echo $content = apply_filters('the_content', $page_data->post_content); 

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is

Leave a Reply