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
- Apply the_title() filter in post & page title, but not in menu title
- The next_posts_link() works only with original $wp_query
- Post slugs and images cannot have same name?
- Pretty URL with add_query_var
- How do you get all the urls of images attached to a post?
- Display posts by tag on page
- Can I change a post to a page by changing it’s type?
- Add a custom option to a page in backend
- Creating new page with pre-defined parent page
- Populating a page with content from post custom fields
- What Defines What Category A Post Picks (if in multiple)
- Custom post type permalinks breaking due to 3.1 bug fix
- disable column on post and user list
- Can a page_id and a post_id be same?
- How can I display widget in a Page or Post?
- Differentiate between posts and pages in search results
- Getting a 404 error when clicking edit page
- How to display related posts by subcategory and not parent category
- Problem with permalink routing?
- Host frontpage via example.com and everything else via example.com/blog
- When open add new post or page WordPress add post with ID=0 continuously [closed]
- How do I do a page break?
- static landing page leading to author specific pages w/ “live” content
- “-2” Being added to end of URL (no duplicate pages, no pages in trash)
- WordPress 302 Redirect to Random Product/Post/Page
- Updating permalink structure using ‘post_link’ filter results in 404 error for posts
- When WP_Query only returns 1 post, how do I automatically redirect to that post?
- Direct some posts to only appear on a specific page
- Standalone form does not post to the url when form fields are populated (otherwise it does)
- Different post views for different category views
- Permalink structure and dedicated comment pages
- Indenting within a blockquote
- How to prevent to create same url of post, if the previous was deleted?
- Change published date and time using SQL query for page in every 5 hour
- How to bulk Update URLs to new values?
- My post permalinks are redirecting to the post archive page for some reason?
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- How do you change the permalink for posts for a single category?
- How to add a block to a category page?
- calling pages instead of posts
- WordPress display page information rather than post
- Post Category link is same with Page link
- Querying posts from current category, using a variable as array argument
- Converting Posts to Pages
- Use a custom post URL that is outside the blog root directory
- 404 error on every post and page other than home
- Change link to permalink inside post content
- Get post title of faulty link on 404 error page
- The next_posts_link() works only with original $wp_query
- How to display subcategory articles in the category view?
- Change posts URL [duplicate]
- Limit amount of pages shown in pagination within wp_query
- How can we pass a value from the_permalink() at WordPress?
- How to make posts appear under pages
- How to change Permalinks only for Blogposts
- wordpress category Description not allowed tag
- Post page still linked to old site
- Permalink structure for two separate blogs
- Header and Footer options in pages and posts
- Change permalinks in posts via SQL