The below should make the page post type no longer search-able.
function remove_pages_from_search() {
global $wp_post_types;
$wp_post_types['page']->exclude_from_search = true;
}
add_action('init', 'remove_pages_from_search');
Related Posts:
- grep for special characters in Unix
- How can I implement a location based (zip code) search in WordPress?
- How to highlight search terms without plugin
- Remove meta robots tag from wp_head
- Template issues getting ajax search results
- How do I filter the search results order?
- How do I search events between two set dates inside WP?
- Search Using Post ID
- template_include for search.php makes WordPress think its on the home page
- Include custom table into search results
- ElasticPress Indexing multiple sites
- How to search through pdf media files?
- WordPress Single Conditional for Search Page
- How do I properly redirect outbound links with special characters
- Do not allow to search certain words
- get_query_var(‘s’) not working
- Display Categories in Search Results
- Display title for search engine visitors
- How to avoid the specific page while searching in WordPress without plugin?
- How to show a random selection of posts from the search
- Is it possible to search authors by profile field?
- Search result conditonal tag
- Related Tags Concept
- Default WP search excluding specific characters, is it possible?
- Comparing between a negative and positive number
- Get search term not on searh results page?
- Searching by meta values showing inappropriate result
- Search by keywords with boolean operators
- Transliterating search term in another language
- Redirect All Search Links Containing – to + on WordPress
- How to make wordpress Dynamic Search-Bar from Predesigned Static Html Search-Bar?
- How to exclude events (custom posts) from search, if the start date has already passed?
- How to conditionally pass a parameter to wordpress search to limit post types?
- Change Search url slug for each site in a multisite network
- Change WordPress search Permalink structure
- URL search link for ‘category__and’ instead of php query
- How to load WP categories into array for autocomplete?
- Custom SQL query on wp_users with the addition of wp_usermeta
- Search media by title and description – Frontend
- Is there a way to add a custom text + link above search results for different searches?
- How to change tab’s title in search results pages? [closed]
- Customise Excerpt start and end
- Template issues getting ajax search results
- How can I implement Search feature for Membership site?
- WordPress search with quotations returning to homepage
- Post 2 Post Site Search
- Using search.php without a ‘s’ field in searchform.php
- How to display search results in search.php
- Search WooCommerce Products in WordPress
- WordPress search page doesn’t work with either $_GET or $_POST
- some one help . search not jump to search page
- Why should we use the name attribute with the value “s” in the creation of the search form?
- The Search FoRM Dilemma || The Search form Templating
- Why WP_Query’s ‘s’=>’keyword’ searches only for ‘post_title’ and why not ‘post_content’?
- Search for anything in site
- How can I add search box in single.php?
- Connecting Google Site Search with WordPress Taxonomies/Categories/Tags
- Dashboard search function doesn’t work well
- Only display post content in search results
- meta post search
- search page not found? (search.php or searchpage.php)
- Page 2 of Search Results shows homepage
- Media Library / Backend: How can I search for text in the ALT Text field?
- Extend product search to search in attributes
- Rewrite wp function
- Return All Tags from Search Result in Separate List
- Custom database table and custom search
- How to fetch Email addres of an author via ID?
- Can I replace the search bar with Programmable Search by Google?
- Banning special characters in search form input
- How to Fix Form elements do not have associated labels in WordPress Search Form (without button)
- How to exclude specific post_type from default search?
- Search issue on special Character
- Modify main search form to search user too
- Removing &submit=Search from search parameters?
- customize search result in wordpress
- pre_get_posts improperly searching revisions
- Highlight search words in excerpt
- Why is wp_dropdown_categories not searching within the sub-categories in my custom taxonomy
- $_GET value is losing it’s space
- Search For Custom Post Type and Custom Fields
- Searching on my blog is not working
- WP search in metadata post
- “Modular/reusable” content and search results
- Add Search Form to Dropdown menu
- Search multiple custom post types with tags
- Search doesn’t work with ‘relation’ => ‘OR’
- Add meta tag to search results
- Searchform for searching specific categories
- Selectbox and Searchform and Custom Search Page
- Hightlight search-terms with functions does remove or disable other filters?
- SQL: Search query to get attachments only of those parents which are published
- Change the text “search result for” on search result page
- Search redirects to index
- Want to creat a search for my wordpress theme [closed]
- Return 404 for /search/ queries – For Genesis
- Deprecating WordPress URL from Google, promoting custom domain [closed]
- Search with multiple selects that include tags
- Search results from a specific database table
- Wp admin: I need search meta key from table wp_usermeta in screen custom post type