Title: Replace only in document body
Last modified: January 26, 2018

---

# Replace only in document body

 *  Resolved [akuzma](https://wordpress.org/support/users/akuzma/)
 * (@akuzma)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/replace-only-in-document-body/)
 * Hello there,
 * I want to use this plugin to style specific words with CSS. For example, I let
   it replace ‘word’ with ‘<span style=”color:red !important”>word</span>’.
 * The Problem is: The plugin replaces the word in the header too, so if the page
   contains the word the title, it produces forbidden tag within <title></title>
   and other meta tags.
 * Is there a possibility to fix this problem?
 * Best regards,
    Andreas
    -  This topic was modified 8 years, 3 months ago by [akuzma](https://wordpress.org/support/users/akuzma/).

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

 *  Plugin Author [Marios Alexandrou](https://wordpress.org/support/users/marios-alexandrou/)
 * (@marios-alexandrou)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/replace-only-in-document-body/#post-9906623)
 * Expand the Find portion to limit what is matched. For example, ensure that there
   is a certain HTML tag included in the matching portion so that only the occurrence
   you want to replace is replaced. Chances are you’ll need to use the RegEx option
   so you can do advanced matching.
 *  Thread Starter [akuzma](https://wordpress.org/support/users/akuzma/)
 * (@akuzma)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/replace-only-in-document-body/#post-9917602)
 * Thanks for your answer, unfortenately it doesn’t help.
 * Example: If I want to apply CSS to a special character (i.e. colorize all exclamation
   marks red) without using client-side JavaScript, I would use your plugin to search
   all ‘!’ and replace it with ‘<span class=”red”>!</span>’ but this will happen
   also to the head and produces an error, if the <title> contains an ‘!’.
 * Maybe you have a better idea to realize something like that?
 *  Plugin Author [Marios Alexandrou](https://wordpress.org/support/users/marios-alexandrou/)
 * (@marios-alexandrou)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/replace-only-in-document-body/#post-9917662)
 * You’d probably be better off looking into how to modify the output of the the_content
   function in your theme.

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

The topic ‘Replace only in document body’ is closed to new replies.

 * ![](https://ps.w.org/real-time-find-and-replace/assets/icon-256x256.png?rev=1347950)
 * [Real-Time Find and Replace](https://wordpress.org/plugins/real-time-find-and-replace/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/real-time-find-and-replace/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/real-time-find-and-replace/)
 * [Active Topics](https://wordpress.org/support/plugin/real-time-find-and-replace/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/real-time-find-and-replace/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/real-time-find-and-replace/reviews/)

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [style](https://wordpress.org/support/topic-tag/style/)

 * 3 replies
 * 2 participants
 * Last reply from: [Marios Alexandrou](https://wordpress.org/support/users/marios-alexandrou/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/replace-only-in-document-body/#post-9917662)
 * Status: resolved