Title: Replace the_title() code
Last modified: March 8, 2023

---

# Replace the_title() code

 *  Resolved [steve92](https://wordpress.org/support/users/steve92/)
 * (@steve92)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/replace-the_title-code-2/)
 * I would like to know what is the file with **the_title()** code because I want
   to replace it with **relevanssi_the_title()** so then it also highlights the 
   post titles.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/replace-the_title-code-2/#post-16542104)
 * There’s no single answer to this; it depends on your theme. The file `search.
   php` in your theme is the best place to start. Another common place is `template-
   parts/content-search.php`.
 *  Thread Starter [steve92](https://wordpress.org/support/users/steve92/)
 * (@steve92)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/replace-the_title-code-2/#post-16542142)
 * I have 2 sites and found the code in 2 different files: **/template-parts/content-
   excerpt.php** and **/inc/structure/content-extensions.php**
   It would be nice 
   if you put the default code in the next version.
    -  This reply was modified 3 years, 3 months ago by [steve92](https://wordpress.org/support/users/steve92/).
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/replace-the_title-code-2/#post-16542155)
 * That is, unfortunately, impossible: Relevanssi cannot modify your theme files.
   In an earlier version, using a separate function wasn’t necessary and the highlights
   were added automatically, but that doesn’t work: `the_title()` is used outside
   post titles, and the highlights would appear to menu items, sidebars and other
   places where they don’t belong to.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Replace the_title() code’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/replace-the_title-code-2/#post-16542155)
 * Status: resolved