You could hook into the the_permalink
filter and check for is_search()
to conditionally modify the URLs of your search results to include some additional parameters that your single.php
then checks for. Something like this (may require tinkering):
add_filter( 'the_permalink', 'wpse155331_the_permalink' );
function wpse155331_the_permalink( $url ) {
if ( is_search() ) {
$url = add_query_arg( array( 'from_search' => 'true' ), $url );
}
return $url;
}
Related Posts:
- Conditional tag search-no-results
- Is_search not working on search results page
- Search Results: Differentiate posts and pages
- Why does this search.php not work?
- Page has no template
- Solr vs. ElasticSearch
- How to make search include data from wp_postmeta?
- Conditional for single-{post-type}.php
- Limit search to latin characters
- Display search results within the same page
- Search in WordPress – Difference of searchpage.php, searchform.php and search.php?
- How do I redirect /search/ to wordpress search template?
- Exclude top-level pages from search results
- Search in non-English language returns only one result
- Complex Search functionality. Advice needed
- How can I implement faceted search with WordPress 3.x?
- can’t limit search to only pages
- Change the Search Base in a multi language wordpress
- How to exclude post body from WP search
- Search results URL without query string variables
- How to control WordPress Search Behavior?
- Do not allow to search certain words
- How to avoid the specific page while searching in WordPress without plugin?
- Best way to Integrate Google Search?
- Related Tags Concept
- How to add additional search terms (e.g. synonyms) to the search?
- Combine internal search with Google custom search?
- Any reason why search result lists only one entry?
- Display just child pages of a certain page in search results
- How to make wordpress default search to woocommerce search
- pre_get_posts action: Search by post_title and post_content with different search phrase in the same query
- Why won’t is_search work inside functions.php?
- Search functionality – include date, category and author search
- WordPress Search matching hyphenated words
- How to make wordpress Dynamic Search-Bar from Predesigned Static Html Search-Bar?
- How to stop WordPress Search form from searching only in current page?
- How can I make a search form that can search taxonomies and posts?
- How can I include author (their archive page) in search results?
- How to search media library alt text and title fields
- how to create search and filter form generating “plus” symbols in url in between category names?
- Meta query: How do I return posts within a date period from a given month?
- Creating a Searchable PDF Archive of Publications
- Display post titles that match string in post content
- How to display search results in search.php
- Search – Only search for post meta field
- Search Form Based On Tutorial Not Working
- how to show Author information in search results
- Why should we use the name attribute with the value “s” in the creation of the search form?
- Sitelinks Search box schema confusion
- Display Search Results after search 1st link
- Make archive page show up in search results?
- WordPress custom search by post type
- WP_User_Query not searching
- meta post search
- “Revision” records in wp_posts have original post type instead of “revision”
- Search engine for WP as CMS [closed]
- Breadcrumbs: Search result not displayed when static page is on top
- Can’t place two custom post types into the WordPress search query?
- Replacement search plugin that reads widgets or catalogs entire page?
- Rewrite wp function
- WordPress custom search only works from some pages
- WordPress search – Display the paragraph which has the searched word/term
- Search to include external content
- Search issue on special Character
- Search button click sends to single-custom_post_type instead staying at the same page
- pulling in external JSON search results into WordPress
- How to Integrate Live search in WordPress?
- How to create a custom filter in WordPress?
- search results in custom template search.php
- Search results are showing full page instead of sample
- customize search result in wordpress
- Highlight search words in excerpt
- Search: display all found matches inside post
- Search For Custom Post Type and Custom Fields
- WordPress search.php pulling search results but also matching a page and pulling that information in
- Search Results Customization
- Search.php Modification Needed
- Search taxonomy terms, not posts
- “Modular/reusable” content and search results
- Add Search Form to Dropdown menu
- I want to edit the search function
- Searchform for searching specific categories
- How to display articles based on composed tag
- SQL: Search query to get attachments only of those parents which are published
- Search query with quotes
- Search Results with googlemaps
- 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]
- How do I create a search form that searches only within a custom post type?
- Two Querys in one Search – Category-Tag nightmare – HOW?
- Making ACF fields appear in search results
- How to make wordpress Dynamic Search-icon from Predesigned Static Html Search-icon?
- Code in the excerpt of the search page
- search ALSO by POST-ID with a public front-end search box
- WordPress REST API response – not returning results from custom taxonomy, only from title
- Members location sortable based on UK Postcode
- how to create a multi selector dropdown search box by code?
- I had removed my phone number from my website footer, but months later it still appears once I look it up on google, how to remove it?
- search posts by POST ID