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
- How to search for categories and/or tags?
- Get page content by category or tag
- Sticky posts on home page, search, tag and archives without plugin
- 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]
- Custom Query to search through categories
- 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]
- How do I get the total number of categories in a list of search results?
- Category Search functionality on category metabox (wordpress admin)
- Search by word, category, tag, author
- Show posts of category in a page
- Filtering search results
- 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
- Viewing category pages without the word ‘category’ in URL
- in_category() works in single.php but not in page.php?
- Categories vs. Page Site Organization
- Multiple Category Search
- 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?
- Hard coded main navigation
- How to query post like normal search would do. within search.php page
- How to make 2 tag feeds show up on 1 page?
- WordPress search only showing a few posts
- 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
- How do I toggle pagination on/off in search results and category listings via a link?
- 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
- Custom category URL rewriting
- 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
- How do I display something on a particular category page?
- Automatically redirect a page to a category that share the same slug
- How to create a subcategory to a PAGE on WP?
- Get the ID of 10 Latest Pages stored in a WordPress Category
- How to show 5 posts from specific category on related page?
- Get URL Category Name By ID
- How do I get category and page ID’s?
- How to put page numbers with the next/previous on a post/category list?
- How do I attach a page to a category similar to how we attach media to a post?
- How can I display tags as categories?
- Trying to create a Categorised Index (archive?) to use as my Home Page
- “Virtual category page” based on a custom field filter
- Woocommerce search form with category select
- Getting the Most Recent Posts from Multiple Categories
- 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
- WordPress Default Category and Custom Taxonomy Selected Attribute not Working After Searched in wp_dropdown_categories Array
- 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?
- Template category.php with page (no posts)
- Showing the category hierarchy as clicked in WordPress, with image and desc
- How can I make a category function as a page?