Add in the search parameter to your query:
$search_filters = array(
'post_type' => 'page', // Doorzoekt alle post types
's' => $keyword // show only posts that meet the current search query
);
And above that you should just be able to grab the keyword right from your querystring like so:
$keyword = $_GET['s'];
There’s also a WordPress native function that grabs your current search query which might be better to use than grabbing it manually from the querystring:
$keyword = get_search_query();
Related Posts:
- Search in custom post type AND in pages with category
- How to check if I’m on the last page of posts?
- What is a good robots.txt?
- WordPress Multiple Category Search
- Exclude categories from search query
- Get page content by category or tag
- Create product category and keyword search form in woocommerce? [closed]
- Category page showing posts from all categories
- Loop with Dynamic Categories
- Create a full width responsive header image per page
- Remove child products from woocommerce category page [closed]
- Using same slug name for a page and category
- Remove “Category Archives: title” at the top of a category page [duplicate]
- How to have a static category/author page?
- Listing all posts from current category on page
- I use same slug name for category and page
- How to show empty category in admin menus search
- Page with the same name of a category
- How to select product category while adding new product in woocommerce? [closed]
- Category Search functionality on category metabox (wordpress admin)
- Search by word, category, tag, author
- Show posts of category in a page
- Show pages and articles in category search result
- How to create taxonomy values for pages and list them in wp-admin
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- Duplicate Category and Page URL loads Category instead of the Page
- Add a specific category at a specific place to the menu that uses wp_list_pages
- Help with multiple dropdown tags search
- in_category() works in single.php but not in page.php?
- Categories vs. Page Site Organization
- How do I automatically put categories and their descriptions on a WP Page?
- get_the_category and echo out link to child-most/deepest category
- editing fonts of category links from the_category() funtion
- I need to create a search form that will display search results from specific category
- Is it possible to restrict viewing of category PAGE to logged in users only?
- Search Posts / Pages with multiple options?
- How to query post like normal search would do. within search.php page
- How to make 2 tag feeds show up on 1 page?
- Site search needs to find posts for category topic AND Tag or keyword thats not in the post
- Select posts by name and category per REST API
- posts_nav_link(); picks up index.php instead of category.php as template
- Give a page priority over a category that has the same name?
- Multiple URL’s based on category for one post
- category permalinks
- How to “group” (categorize) the Pages together?
- Different banner for different section
- Refine/Filter the Search Results by Category
- Putting a Category of posts under a Page
- How can you change the permalink for pages?
- Show matching categories in search page
- Should I use “Categories ” or “Pages” for a WordPress Static Site (A non blog site)?
- Category.php loads first before page.php?
- How to insert category list into post creation page, and retrieve chosen categories?
- Keyword search in multiple categories
- Automatically redirect a page to a category that share the same slug
- Get URL Category Name By ID
- How do I get category and page ID’s?
- How do I attach a page to a category similar to how we attach media to a post?
- Trying to create a Categorised Index (archive?) to use as my Home Page
- Showing Categories for Page Edit – without plugin
- Using if statement in index.php instead of creating separate template files
- Using categories with pages
- Add posts of a certain category to a page
- Search form options group categories
- custom query for both category and pages using global $wpdb;
- Posts of specific category on page and excluded from index.htm
- Custom Portfolio Page
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- How to use category slug with a regular page
- display specific category when website loads
- remove url from categories
- Automatically adding tags and categories into Post Excerpt for searching
- Return all Tags and Categories in Separate List
- How to redirect to category page if page does not exists?
- Page category filter in admin dashboard
- How to prevent WordPress from redirecting single page to prefixed category archive with same name?
- How can I make a category function as a page?
- Search Replace Database ONLY for posts of certain category?
- displaying one category on one page
- Need help to structure our a complex hierarchy
- Issue with WordPress category search
- get_terms sort order with child categories of varying depth
- Category For Pages In WordPress
- 404 error when i try to search by category or by tag
- Make related posts display first in search result
- Getting page/category content to show up in my custom page template
- Paginations in Category Page Leads to Sample Pages
- Using categories and pages in menus
- Using wp_list_pages to create 2 lists of pages and include and exclude some of them depending on their category
- Several loop in search result
- Pages, Categories, and working with someone else’s code
- Twenty Eleven Theme [duplicate]
- If searched in a category show different 404 page
- Page redirecting to category (IE only)
- Need help with category page customization meeting certain condition
- Search functionality with multiple categories
- not empty categories don’t show in menu [closed]
- How to display posts by author in a separate page, other than author.php?
- Remove “All categories” from searchbar dropdown
- Display different sidebar based on search results from one category