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/
Related Posts:
- Can we have a php “page” without a WordPress “page”?
- Put a link to a category round a hard coded A HREF
- How to retrieve the content (with a specific ID) via ajax by clicking a link tag
- Get ID of child from child slug, while knowing parent ID
- Passing the page ID to a login php script
- get_users(…) only returns one user
- Get posts with at least one category in common with current post?
- Rename “Portfolio” slug?
- How do I attach a php file to an arbitrary slug and still have access to the wp-core functions?
- How to query for pages/post depending on slug?
- WordPress custom slug (endpoint) and compare all links
- Global variable $post returning incorrect object
- How do you use WP slugs for PDF files / media?
- WordPress plugin for nicer looking slugs? Have multiple pages named the same but they get different slugs
- What is an equivalent of single_cat_title for getting the slug of the category?
- What query string parameter is available for index.php, that works for both pages and blog articles?
- php script to change slug in post automatically
- Open post-content in archive page in a Modal box with bootstrap
- List taxonomy term slugs within shortcode (do_shortcode)
- Making (and edit existing) posts with ID included
- Help getting previously visited pages ID
- get_the_ID() in the footer returns wrong value
- Use post ID in functions.php file adminside
- page-slug.php not working but only for specific slug
- echo esc_url( get_permalink($post->ID) + complete the ID’s url
- Remove slugs from custom posts type
- create front-end users post list by specific category
- php return username of currently viewed author profile
- Getting the slug into a variable, how to echo that variable
- Give ID to divs inside the loop
- Allow two posts (from different categories) to have the same slug
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- Get nice name of category from slug (remove dashes of category)
- How to block specific user id in custom login form?
- Get current user id in function php
- Custom PHP form needs refresh to load page correctly
- Slug duplicates once clicking on link
- Trying to get post ID outside loop on blog page
- Rewrite rule not working, but only when parameter is text
- Trying to get property ‘ID’ and ‘post_author’ of non-object error
- How to get the url of the entry in which an image belongs
- Hide a specific category title from displaying on site
- Exclude a category slug on pagination
- How can I output the slug of a comment author?
- WordPress using get_term to retreive slug not working as expected
- Weird slug in archives permalink
- php string inside shortcode does not work
- main menu page redirects to user ID
- get_category only returning details for ‘uncategorized’
- How to disable page create for custom post type, but allow a page with the post types slug to be created?
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page
- Create a custom plugin with dynamic child pages listing database records
- WordPress post-template null warnings
- Hide ID for WordPress User Role Subscriber
- Trying to GET data with ajax from database and show in fullcalendar
- Custom plugin with dynamic child pages listing database records
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- What does -> mean in WordPress?
- Add data-id attribute to child page links
- WP_OPTIONS table, active_plugins entry [closed]
- Parsing Menu Items and Blog Posts
- Store post content in a php variable and output them using for loop
- Pagination on Custom Post
- Resize image to specific dimension (X to Y ratio)
- Fixing Memory Leaks in WordPress (HHVM)
- Writing PHP code in pages without issue?
- How to use theme function in post/page?
- Running rmdir function on post save
- Logic on a Gravity Forms redirect [closed]
- How to add div blocks after certain set of post
- How to pass a PHP $_GET variable and fetch/output it?
- how to disabled a button when press three times
- Get html data with javascript to php array and store to wordpress database
- Echo a shortcode div after every 3 posts
- Preg_Match(): compilation failed unknown property name
- Post images are not displayed on the front page
- do_action(), iFrame Gets Displayed Despite Password Protection [closed]
- $wpdb returns duplicate posts
- How to avoid duplicates when creating recent network posts
- esc_url( ) won’t use https
- Get all categories post is not in
- zip unzip attachments in wordpress
- php if username is role
- Function returns post URLs rather than retrieving Facebook Graph API data
- Ajax button not working
- Creating WordPress Shortcode with Variable
- Catchable fatal error: Object of class stdClass could not be converted to string
- Add shortcode in my div
- Get title attribute from galleries
- Syntax error in a shortcode function
- Execute a function every hour in the background
- How to add text to the start of all comments?
- If else statement to check for thumbnail and whether or not it’s a mobile device – streamline
- How can I display a div ONLY if it is not a certain term page
- Does anyone know all parameters of get_comments()
- Accessing $post after PHP is executed
- How can I automatically resize up images to fit into all of my registered image sizes
- Create page with custom php script and fetched data
- Next post link on a bootstrap button
- Flexslider won’t work on WordPress