Text Replace
This plugin allows you to easily define text or HTML that should be used in your posts in place of words or phrases that are actually present in the posts. This is a handy technique for creating shortcuts to common, lengthy, or frequently changing text/HTML, or for smilies. Additional features of th
This plugin allows you to easily define text or HTML that should be used in your posts in place of words or phrases that are actually present in the posts. This is a handy technique for creating shortcuts to common, lengthy, or frequently changing text/HTML, or for smilies.
Additional features of the plugin controlled both via settings and filters:
- Text replacement can be enabled for comments (it isn’t by default)
- Text replacement can be made case insensitive (it is case sensitive by default)
- Text replacement can be limited to doing only one replacement per term, per post (by default, all occurrences of a term are replaced)
- Text replacement can be handled early or late in WordPress’s text filtering process (it’s early by default)
- Text replacement can be expanded to affect other filters
A few things to keep these things in mind:
- Your best bet with defining shortcuts is to define something that would never otherwise appear in your text. For instance, bookend the shortcut with colons: :wp: => WordPress :aol: => America Online, Inc.
Otherwise, you risk proper but undesired replacements:
Hi => Hello
Would have the effect of changing “His majesty” to “Hellos majesty”.
- If you intend to use this plugin to handle smilies, you should probably disable WordPress’s default smilie handler on the Writing Settings admin page.
- This plugin is set to filter ‘the_content’, ‘the_excerpt’, ‘widget_text’, and optionally, ‘get_comment_text’ and ‘get_comment_excerpt’. Filters from popular plugins such as Advanced Custom Fields (ACF) and Elementor are also handled by default (see FAQ for specifics). The “More filters” setting can be used to specify additional filters that should be handled by the plugin. The filter ‘c2c_text_replace_filters’ can also be used to add or modify the list of filters affected.
- Text inside of HTML tags (such as tag names and attributes) will not be matched. So, for example, you can’t expect the :mycss: shortcut to work in <a href="" style=":mycss:">text</a>