how to get page id of a page using page slug

I’m pretty new to WordPress and I was wondering if I could get a page id with its slug. Is it possible please let me know? 7 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/

Remove slug from custom post type post URLs

It seems that all web resources based on the subject of removing a custom post type slug ie yourdomain.com/CPT-SLUG/post-name are now very outdated solutions often referencing pre WP version 3.5 installs. A common one is to: ‘rewrite’ => array( ‘slug’ => false, ‘with_front’ => false ), within your register_post_type function. This no longer works and … Read more

Is it possible to get a page link from its slug?

Is it possible to get a page’s permalink from the slug alone? I’m aware that you can get the page’s permalink from the ID using get_page_link(): <a href=”https://wordpress.stackexchange.com/questions/4999/<?php echo get_page_link(40); ?>”>Map</a> I’m curious if there is any way to do the same with the slug of a page – like this: <a href=”https://wordpress.stackexchange.com/questions/4999/<?php echo get_page_link(“map’); … Read more