Support » Plugin: Highlight Search Terms » Prevent highlighting when clicking through to result

  • If you’d like to prevent the plugin from continuing to highlight terms after you’ve clicked through to the search result, add this to your functions.php.

    add_filter('post_link', 'remove_hilite_search_query', 11 );
    add_filter('post_type_link', 'remove_hilite_search_query', 11 );
    add_filter('page_link', 'remove_hilite_search_query', 11 );
    
    function remove_hilite_search_query( $url ){
    	if ( in_the_loop() ) {
    		$url = remove_query_arg('hilite', $url);
    	}
    	return $url;
    }
Viewing 1 replies (of 1 total)
  • Plugin Author RavanH

    (@ravanh)

    Excellent solution. Making this sticky 🙂

    Thanks for sharing !

    • This reply was modified 2 years, 11 months ago by  RavanH.
Viewing 1 replies (of 1 total)
  • The topic ‘Prevent highlighting when clicking through to result’ is closed to new replies.