/ Published in: PHP
                    
                                        
Returns the post or page id using the name/slug of a page.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function getPageByName($page_name) {
global $wpdb;
$page_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."'");
return $page_name_id;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                