get_page_by_path( string $page_path, string $output = OBJECT, string|array $post_type = 'page' )
Docs : https://developer.wordpress.org/reference/functions/get_page_by_path/
由頁面的 slug (名稱、代稱、路徑 ) 之字串取得,頁面的物件
example :
$object = get_page_by_path('about');
$object = get_page_by_path('about/service');
$object = get_page_by_path('about',OBJECT,'post');
參考
https://stackoverflow.com/a/29770273
https://gist.github.com/lcdsantos/b25d21a0afb85bd89a41fc48afb6b609
https://developer.wordpress.org/reference/functions/get_page_by_path/