how to get page id of a page using page slug

Use get_page_by_path($page_path):

$page = get_page_by_path( 'about' );
echo get_the_title( $page );

This will return a regular post object.
Documentation:
https://developer.wordpress.org/reference/functions/get_page_by_path/
https://developer.wordpress.org/reference/functions/get_the_title/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)