You just need to add post_type
argument like this:
$wp_query = new WP_Query( array(
's' => $_GET['s'],
'post_type' => array( 'post', /* add more post types if need be */ ),
) );
Read the codex article about WP_Query
class for more information.
Related Posts:
- Can I force WP_Query to return no results?
- Broken? WP_Query and “attachment” as a post type
- Post_count only shows the number of results per page
- WP Query where title begins with a specific letter
- Is it possible to query all posts that don’t have an attachment?
- How to paginate wordpress [gallery] shortcode?
- Search custom taxonomy term by name
- Order Search Results Page by meta_value If no Value Return Remaining Results
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- Getting attachments by meta value
- Count the number of images uploded on the website
- How to paginate attachments in a secondary query as gallery?
- Tracing the life of a query
- Want to redirect if search query match exact title of any post
- How do I exclude all images from a wp_query?
- get images attached to post
- Pagination not working for Custom search form & custom result template
- How to support multiple search terms query within one process?
- Pagination broken when merging search results with additional WP_Query
- Custom search form with empty parameters
- How to search by title or tags exclusively?
- WordPress search exact match
- Pagination wont work with search results template [duplicate]
- WordPress search WP_Query to cover multiple post types and their custom fields?
- get all images from the wordpress media library with link to the post they are associated with
- My combination of ‘post_type’ and ‘tax_query’ not working?
- How to prevent WP_Query from filtering on ‘s’ but keep ‘s’ for other purposes?
- Block internal search queries with pre_get_posts and regex rules
- Add dynamic search to paginated WP_Query
- How to make the WP query search for the “s” arg in other places too
- Search Exact on WordPress – Relevannsi Solution Not Working
- Excluding posts from search results page with meta query not working
- Pagination repeating posts on search results
- I have problems with the search query using multiple post types
- WP_Query no result if keyword contains number
- Multiple WP_Query args combinations according to post type
- Categories In English version showing not canonical URL, instead shows query search result
- Filter admin ajax data by url query
- How to restrict add media library only to images of the same post family?
- How to extend WP_query to a specific table?
- Display the search results like the original pages
- How to use jQuery validation to set the search bar to accept only a specific input?
- how to get custom attachment url?
- Display Search Results by tag_ID in my search.php
- How to debug none working search query?
- getting posts by tags
- Add to search posts query array with post IDS which will appear first
- Custom Post Type WP_Query with filters and search
- Search with WP_Query, but ignore href URLs in anchor tags?
- WordPress search page pagination displaying but not functional
- Search has query that will return no results
- WP Query – Search in title or author_name
- Limit default Search query to post_title
- Get posts by similar names and categories
- Logging search queries for logged-in users
- How to show terms from another taxonomy
- Search Field that allows options of “Match any keyword” or “Match all keywords”
- Order & Orderby clause not working with custom query
- How can I modify standard search query to include also ACF custom fields values?
- A very strange problem with search query
- wp_get_attachment_image not to get the post_thumbnaill
- Query All Attachments and Order by Parent Publish Date
- How To Query All Attachment Images Found In Post Galleries
- Search format not matching taxonomy query
- How to make the default WordPress search return borader results
- Search Functionality broken by the wp 4.2 update
- WordPress WP_Query offset parameter not working with search parameter
- Custom search (wp query by custom fields)
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- WordPress WP_Query Array Custom search via taxonomies
- Custom Search Query – include only custom fields and title
- $wp_query when new WP_Query
- Using WP_Query to get attachment returns empty set
- Need help setting up a search form for wordpress [duplicate]
- Search Query that Includes Custom Table
- Some images not being returned with wp_get_attachment_image
- Manipulating a query
- Custom search: Search posts but display parent page in results
- Query posts by custom fields
- Loop issues when creating custom query for media uploader
- Searching in specific custom post type
- Search (Custom Form, Custom Search Result)
- Help with showing text when something is entered in my search bar
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- Filtering product search results using tags
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- How does Show Posts based on a keyword search work in WP_Query
- Search query alteration not working for meta values
- Give attachments an archive page, and exclude unattached ones
- Search results stuck on page 1
- on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query
- Custom Taxonomy in custom REST API search
- Advanced Search – Is this possible?
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string
- AJAX multiple search boxes not merging with array merge
- Removing filename searches when searching attachments
- Modify WordPress Search
- Rewrite URL custom search query