It is hard to tell exactly what you’ve done, and it sounds a bit messy, but I think you’ve created “Pages” using the child templates as the “Template” under page attributes.
That, or you are linking to them directly with wp-content/theme/themename/templatename.php
. You never want to link directly like that, but if that were the case I have no idea how the search would “get the permalink”.
I don’t know how else those templates would “its own URL” and either way would be wrong.
You should be creating all of the pages– parent and child– using the “main template” as the “Template”. If that template is constructed correctly, everything should load in context correctly.
You should also look into get_template_part
.
Related Posts:
- How to get full content including template HTML
- Get the url of a page template without using the page slug and ID
- All top-level pages are using index.php as template
- Changing permalink name redirects to another template?
- How to make different urls for some tags pages
- wp_get_attachment_url not working
- Pretty permalinks for search results with extra query var
- How to use relative links on my pages?
- How can I store page ID in a post instead of other selected permalink?
- How to get a page url by a page id?
- Why does WP not use relative links when linking pages?
- Menu Link Redirect Based on Username or User ID
- Social Media Links on homepage – within posts/post loop
- custom naming of search permalink /search/
- Change website URL without breaking links or images? WP 3.3
- Rewriting search permalink
- Is it possible to list post attachments in a sub URL endpoint with a dedicated template?
- Redirect user if it’s not logged in
- Search result permalink
- Adjust which tempalte a page uses with a function?
- WordPress not respecting template hierarchy (fetches index.php instead of single.php or page.php)
- I copied my site to another site but all links point to old site
- Link to blog index from template
- Is there a wordpress function that I can use to retrieve the current page that is loaded?
- Change author slug and functionality
- Best way to add internal link in widget
- Confusion about how a URL is being parsed
- Changing search URL to something other than “search”
- Custom permalink for search and pagination
- Automatically append ID to at the end of specific URLs
- why some permalinks adding characters/ruining links
- Avoid WordPress categorizing a permalink request as Not found 404 Page
- Get link to a specific template file [closed]
- How to make /search/ without parameters not return a 404?
- Is there a link parameter that will show me all my published pages?
- How to change old permalink?
- Migrated from Windows to Linux. Any bulk methods for fixing case sensitivity?
- How to eliminate permalink prefix in WordPress Multisite
- How to generate a list of all urls
- WordPress Not Using Template Files After Permalink Update
- How To Load an HTML File As A WordPress Page (With No 301/No Redirect)
- Format HTTP links
- Edit permalink for certain pages
- Environment independent way to link to certain pages on frontend
- cannot link a external url, present page url acting as parent url
- Permalink for specific page name
- Can WP give a value a post ID?
- implement separate templates for 1 post type
- encoded search terms with %20
- post permalinks with dot in url don’t resolve to correct page template
- How to add specific phrase to end of search url
- Moved site, Old links in pages still pointing to old host
- How to use page jumps to top of banner and page title?
- Access or edit custom generated permalinks with WP_Rewrite
- Get Posts Based on Tag Matching Page Title
- How to remove the link of an image on WP 4.2
- optional parameter in permalink structure
- Custom permalink structure for remote content pages
- Create custom links for excerpts with php dynamically
- How can I see a list of all pages my WordPress site has generated?
- A dash can replace a period in a link, how to fix it
- Cannot make custom search permalink to work in a fully custom theme. Search string $_GET[‘s’] is always empty
- Multiple URL rewrite rules and get every prams
- My WP homepage works, but the other pages don’t when accessing from out side of my network
- Replacing + sign to – in wp Search Permalink
- Search button click sends to single-custom_post_type instead staying at the same page
- Can I link to content dynamically from a page to a new page?
- Propper way to set anchor and url param
- Find internal links to post
- rebuilding/ rewriting a url to make it SEO friendly
- Remove link function from oembed image or video
- Single.php not loading when permalink only contains date information
- Rewrite single template permalink?
- How to change dynamic link to relevant post
- Difference and usage of uri (e.g. get_directory_uri) and absolute path (e.g. get_directory)
- “post-name” Renders Using page.php, but “post-name-2” renders with single.php
- single.php being ignored, going straight to attachment.php
- WordPress search seems to look into permalink (which is bad)
- How can I get WordPress CPT archives and page templates to work with prettified permalink settings?
- Search page Paginations not working
- Pretty Permalink for Search Queries Not Working
- Possible to hide parts of the slug from get_template_directory_uri and bloginfo(‘template_directory’)
- Pages included in another page and duplicate content issues for SEO
- After changing permalink settings, everything works fine except for the two most recent posts
- Select page/template from the permalink url
- Latin character conversion
- Pretty links for PHP pages above WP /blog directory?
- Permalink structure as code in back-end?
- Search points to /search/?s=KEYWORD instead of /search/KEYWORD
- What is the issue with our links? It creates a loop
- Text in permalink
- Choose template depending on URL
- Search results highlight breaks my read more link
- Image not Showing (Can see image in inspect element)
- PHP Button Custom link [closed]
- Make all internal links relative, or otherwise make a website accessible from multiple domains
- Non english characters in search bar
- Permalinks Structure and 404 Question
- Pre-populate Slug / Permalink with URL
- I have to specifiy port otherwise the website doesnt work