You could make a list of paths to check…
$page_paths = array(
'analysis/firstNamelastName',
'exercise/firstNamelastName'
);
Then check if there’s a page object for each of the page paths.
foreach( $page_paths as $page_path ) {
echo '<code>' . $page_path . '</code> ' . PHP_EOL;
if( ! $page = get_page_by_path( $page_path ) ){
echo 'Does not exist.' . PHP_EOL;
} else{
echo 'Exists and resolves to: <code>' . get_permalink( $page->ID ) . '</code>' . PHP_EOL;
}
}
You can actually use get_page_by_path();
for Post Types other than page
. See the third parameter.
Related Posts:
- Category URL to use same string as Post URL Permalink
- Blog posts are not appearing as subs of Blog Page
- Strategy for handling hierarchical pages with empty parent content
- How to allow slashes in single posts when i click in the edit permalink button
- Changing my permalink structure – will new layout conflict with existing page?
- WordPress not opening posts with only numbers if permalink is post_name
- Switch to page template when using post permalink
- How to handle broken links created by permalink/slug changes?
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- Retrieve post ID from “querying” URL
- Start post pagination at 0 instead of 1
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- Custom Permalink Structure for Pages & Posts
- Post is blank when I click on the link
- Unabled to Change Permalinks – Even Using the “Edit” (Resets to Original Permalink on “Update”)
- Post/page title to permalink transformation – what is behind the scenes?
- Can Permalink structure of %postname%/%post_id% improve performance
- How to link post titles on page A to its posts on page B?
- Changing permalink of WordPress
- Can I show category name in url for only one of my categories?
- Permalink Short code showing unnecessary link text inside the loop
- Please help a newbie with blog page issue?
- How can I make a post sub link?
- Does having category name in permalinks affect SEO when having a post in multiple categories?
- How to add a ‘News’ section to specific posts in WordPress
- Prevent Archive URLs
- Custom permalink for wordpress page / post
- Permalink base only for posts
- How to give priority to page than to posts permalink structure?
- Precedence of page permalinks over woocommerce product category links?
- Post & Category Archives URL structure
- WordPress URL question
- structure of posts and pages
- How to change post template via url?
- Posts in Page – How to customize the URL?
- One of my posts is displayed as page
- Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL’s?)
- How to mix pages and sub-categories in a url
- Default post type doesn’t display in url
- How to add paraent in Blog post URL in wordpress
- Modify Post URL Programmatically
- Change link to permalink inside post content
- How to arrange different post categories in template
- Moving Posts to a new site and maintaining URLs
- Make assigning post to a specific category equivalent to assigning it to all categories
- Rewrite a specific Post Format to URL slug
- get next/previous post name
- Get part of a page url
- Why are my wp urls showing page not found?
- can’t post immediately
- How can i add new post on new page
- Get post title of faulty link on 404 error page
- Get current post’s child page?
- Make a custom URL and link to custom Template
- Modifying the permalink href for posts with jquery
- How to display a paginated list of posts from one category on a page? [duplicate]
- Displaying only posts from a certain category on my custom page template
- The next_posts_link() works only with original $wp_query
- Changing permalink of custom category
- Change the default video URL in a post to shortcode format
- TCPDF and permalinks
- Cant retrieve $_POST inside page, just header
- I need to create a page or post hierarchy
- Overwrite URL on blog posts
- Home page: using custom fields for posts and pages
- WordPress sub-posts and permalinks
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- Choose options via url
- How to Post to Specific Pages?
- How to display subcategory articles in the category view?
- how to style an individual page in a category [duplicate]
- associate posts to a page
- Change posts URL [duplicate]
- The loop: more posts than I want to fit on one page
- Automatically delete default posts and pages on theme install?
- Redirecting posts in WordPress to a specific page
- 301 Redirecting posts without %postid% (just %post_name%) in permalink to ones with %post_name%_%postid%
- How do I add /blog/ on my permalink without affecting the portfolio project types permalink?
- Woocommerce – custom post type of checkout page
- how to create child posts with parent post in wordpress?
- Posts and pages not getting published
- Limit amount of pages shown in pagination within wp_query
- How do I add an article to specific page?
- Permalink remain the same on each page
- How to have more post in a page than in your home page
- how to show all type of author posts in author page (SOLVED)
- Custom post page has attributes of latest post [closed]
- How can we pass a value from the_permalink() at WordPress?
- custom post type single page template not working
- WordPress “Posts Page” isn’t showing template dropdown
- Wrap div-tag around posts in page
- Adding Count Post in Page
- Read more link not working [closed]
- How to make posts appear under pages
- Insert Shortcode exactly at the end of the content
- Adding a post to a page
- When and how will php code in a user made WordPress page be executed?
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- How to find the page of specific post?
- WordPress Page Column Problem [closed]