I have no idea if this will work, but couldn’t you reference the post_parent
in the query args?
function SearchFilter($query) {
if ($query->is_search) {
//$query->set('post_type', 'page');
global $post;
$query->set( 'post_parent', $post->ID );
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
Again, completely untested. I’m not terribly familiar with using $query->set()
.
Related Posts:
- Manual excerpts for pages not working on Search
- Custom Search Page Pagination Not Working
- When I split a large post with , how can a search locate users to the correct page?
- Form action redirect to the same page
- Two Search pages, One search form
- How get get list of pages in ajax search
- Getting to a specific page on website using specific code instead of navigation bar
- Add Filter to Ignore a Post/Page or a Number of Post/Pages
- Search results to be only posts & children of page ID
- Search anything from a Child and Sub-Pages of their Parent page
- Add pagination to search.php page
- Search Page: activate html code if the tag is on the page
- If searched in a category show different 404 page
- Search page different title per results
- search page different results
- simple category search form returns full text – but I need excerpts
- How to enable automatic search results in WordPress
- Save search criteria per user and show on custom user page
- How can I keep the content of my pages version controlled?
- How do I convert a page’s title to lower case?
- page title, parent tilte and grand parent title
- How to add jQuery script to an individual page?
- How do I set and list page_template with wpcli?
- How to get post or page excerpt using post_excerpt
- Different fields in My Profile page depending on user role
- Object gets unwanted width and height
- WP is not using the select custom template.php that its selected for a page
- What’s the most minimal way in which a page can be hooked into WP?
- Associate Page with User
- Page with page template not using template in Preview
- Subpages return 404 error [closed]
- Limit the number of pages created by the paging
- One page – Multiple parents?
- Check whether the child page has siblings
- How to re-order pages en-masse
- User capability of create page/new page
- how to get specific page content
- is_page condition not working
- Using page slug in array
- Shortcode produces blank page
- How to create a page that contains a list of post titles from specific categories?
- How WordPress manages nested dropdown?
- Creating a 3-column layout on a WordPress Page
- Create page that is not deletable
- I have index.php and other files, how do I display other pages?
- Location-Based Pages displaying results near customer
- Blank Pages with # URL & Google
- Moved WP from example.com/blog to example.com, cannot add pages now
- How to add pagination to a single wordpress page with lot of text
- Multiple alias for single page
- Organizing Your Pages
- Custom page template for multiple pages
- No Appearance panel is shown
- How to have a separate page? What should be the link to that page?
- loading a javascript on a WP PAGE
- WordPress theme: Add page content to the bottom of the Contact form
- 404 Page not found
- Styling Previous/Next Pages differently from Index
- Show FormCraft form on page open [closed]
- Why last blog post excerpt is shown instead of meta description? [closed]
- Prevent non-admin to add/create new pages
- How do you implement a page template automatically being applied to a page?
- Make “default” wordpress pages & features unaccessible
- How to create cutom link for page
- creating single page with 2 columns while theme is 3 column
- Show parent & child pages with featured image and hide the current page
- Outputting content from page
- Use an archive as the parent of a page?
- Publish page by invoking submit via jQuery
- One author not showing in Author drop down list while editing page
- WordPress Page Protect forwards to Admin Login
- How can I edit pages from my local environment?
- Modifying .page-content background image
- products category page editing
- “Can’t update in WordPress”
- Why can’t pages be categorized / tagged?
- Pages in wp-admin is not found 404
- Shortcode runs when editing page
- List of pages of a specific user
- wordpress page navigation numeric pagination showing same posts on each navigation
- WordPress dosn’t save page/post updates
- Multiple meta_key with get_pages
- Sup pages can’t be found
- WordPress Page All Content In Template Good Or Bad Convention?
- Send e-mail from admin area to adresses in custom field
- Bundle a page with custom url and a function
- Custom Upload Adds Ghost File
- WordPress white screen with “All Pages”
- How to exclude sidebar from pages?
- Widget & storing a Select box choice
- Can’t select a page using is_page()
- How can I cycle posts with a #next and #previous script?
- Using Page/Post Slug In Link / URL
- Does WordPress list all pages for crawlers?
- How to display child page from specific parent page in homepage?
- How do I count the number of pages a user has seen on my site, and force them to log in after a certain amount
- Ask for template when adding a new page
- How to view front-end of WordPress website, using Atom?
- I reached halfway through a WordPress tutorial to find out I began wrong for a new comer to WP
- Custom template is not showing up in templates dropdown list after re-naming it