Showing posts with label How to get page ID from Page Name Wordpress. Show all posts
Showing posts with label How to get page ID from Page Name Wordpress. Show all posts

Wednesday, 2 March 2016

How to get page ID from Page Title Wordpress


How to get page ID from Page Title Wordpress

global $wpdb;

$page_name = "Your page title";
$page_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."' AND post_type = 'page'");

return $page_id;