Plugin Directory

Text Replace

Replace text with other text. Handy for creating shortcuts to common, lengthy, or frequently changing text/HTML, or for smilies.

3.7 (2016-05-01)

  • Change: Update plugin framework to 043:
    • Fix error message when text replacement field has trailing blank line.
    • Change class name to c2c_TextReplace_Plugin_043 to be plugin-specific.
    • Disregard invalid lines supplied as part of hash option value.
    • Set textdomain using a string instead of a variable.
    • Don't load textdomain from file.
    • Change admin page header from 'h2' to 'h1' tag.
    • Add c2c_plugin_version().
    • Formatting improvements to inline docs.
  • Change: Add support for language packs:
    • Set textdomain using a string instead of a variable.
    • Remove .pot file and /lang subdirectory.
    • Remove 'Domain Path' from plugin header.
  • Change: Add many more unit tests.
  • Change: Prevent web invocation of unit test bootstrap.php.
  • New: Add LICENSE file.
  • New: Add empty index.php to prevent files from being listed if web server has enabled directory listings.
  • Change: Minor code reformatting.
  • Change: Add proper docblocks to examples in readme.txt.
  • Change: Note compatibility through WP 4.5+.
  • Change: Dropped compatibility with version of WP older than 4.1.
  • Change: Update copyright date (2016).

3.6.1 (2015-02-19)

  • Revert back to using dirname(__FILE__); DIR is only PHP 5.3+

3.6 (2015-02-18)

  • Improve support of '&' in text to be replaced by recognizing its encoded alternatives ('&', '&') as equivalents
  • Support replacing multibyte strings. NOTE: Multibyte strings don't honor limiting their replacement within a piece of text to once
  • Update plugin framework to 039
  • Add more unit tests
  • Explicitly declare activation() static
  • Cast filtered value of 'c2c_text_replace' filter as array
  • Reformat plugin header
  • Use DIR instead of dirname(__FILE__)
  • Change regex delimiter from '|' to '~'
  • Change documentation links to wp.org to be https
  • Minor documentation spacing changes throughout
  • Note compatibility through WP 4.1+
  • Update copyright date (2015)
  • Add plugin icon
  • Regenerate .pot

3.5.1 (2014-01-28)

  • Fix logic evaluation to properly honor case_sensitive and replace_once checkbox values

3.5 (2014-01-05)

  • Fix to allow case insensitivity to work when the text being replaced includes HTML
  • Add setting to allow limiting text replacement to once per term per text
  • Add filter 'c2c_text_replace_once'
  • Change to just-in-time (rather than on init) determination if comments should be filtered
  • Add text_replace_comment_text()
  • Add unit tests
  • Update plugin framework to 037
  • Better singleton implementation:
    • Add get_instance() static method for returning/creating singleton instance
    • Make static variable 'instance' private
    • Make constructor protected
    • Make class final
    • Additional related changes in plugin framework (protected constructor, erroring __clone() and __wakeup())
  • Add checks to prevent execution of code if file is directly accessed
  • Re-license as GPLv2 or later (from X11)
  • Add 'License' and 'License URI' header tags to readme.txt and plugin file
  • Use explicit path for require_once()
  • Discontinue use of PHP4-style constructor
  • Discontinue use of explicit pass-by-reference for objects
  • Remove ending PHP close tag
  • Documentation improvements
  • Minor code reformatting (spacing)
  • Note compatibility through WP 3.8+
  • Drop compatibility with version of WP older than 3.6
  • Update copyright date (2014)
  • Regenerate .pot
  • Change donate link
  • Add assets directory to plugin repository checkout
  • Update screenshot
  • Move screenshot into repo's assets directory
  • Add banner


  • Fix bug where special characters were being double-escaped prior to use in regex
  • Update plugin framework to 034
  • Minor readme.txt formatting tweaks


  • Fix bug where $x (where x is number) when used in replacement text gets removed on display
  • Fix to properly escape shortcut keys prior to internal use in preg_replace()
  • Change default for case_sensitive to true
  • Add handle_plugin_upgrade() to fix logic inversion for case_sensitive setting
  • Fix incorrect help text (inverted logic) for case_sensitive setting
  • Update plugin framework to 032
  • Regenerate .pot


  • Fix bug with settings form not appearing in MS
  • Update plugin framework to 030
  • Remove support for 'c2c_text_replace' global
  • Note compatibility through WP 3.3+
  • Drop support for versions of WP older than 3.1
  • Regenerate .pot
  • Add 'Domain Path' directive to top of main plugin file
  • Add link to plugin directory page to readme.txt
  • Update copyright date (2012)


  • Fix cross-browser (namely IE) handling of non-wrapping textarea text (flat out can't use CSS for it)
  • Update plugin framework to version 028
  • Change parent constructor invocation
  • Create 'lang' subdirectory and move .pot file into it
  • Regenerate .pot


  • Fix to properly register activation and uninstall hooks
  • Update plugin framework to version v023
  • Save a static version of itself in class variable $instance
  • Deprecate use of global variable $c2c_text_replace to store instance
  • Add __construct() and activation()
  • Note compatibility through WP 3.2+
  • Drop compatibility with version of WP older than 3.0
  • Minor code formatting changes (spacing)
  • Fix plugin homepage and author links in description in readme.txt


  • Update plugin framework to version 021
  • Delete plugin options upon uninstallation
  • Explicitly declare all class functions public static
  • Note compatibility through WP 3.1+
  • Update copyright date (2011)


  • Update plugin framework to version 018
  • Fix so that textarea displays vertical scrollbar when lines exceed visible textarea space


  • Re-implementation by extending C2C_Plugin_012, which among other things adds support for:
    • Reset of options to default values
    • Better sanitization of input values
    • Offload of core/basic functionality to generic plugin framework
    • Additional hooks for various stages/places of plugin operation
    • Easier localization support
  • Full localization support
  • Allow for replacement of tags, not just text wrapped by tags
  • Disable auto-wrapping of text in the textarea input field for replacements
  • Support localization of strings
  • Add option to indicate if text replacement should be case sensitive. Default is true.
  • NOTE: The plugin is now by default case sensitive when searching for potential replacements
  • For text_replace(), remove 'case_sensitive' argument
  • Allow filtering of text replacements via 'c2c_text_replace' filter
  • Allow filtering of hooks that get text replaced via 'c2c_text_replace_filters' filter
  • Allow filtering/overriding of text_replace_comments option via 'c2c_text_replace_comments' filter
  • Allow filtering/overriding of case_sensitive option via 'c2c_text_replace_case_sensitive' filter
  • Filter 'widget_text' for text replacement
  • Rename class from 'TextReplace' to 'c2c_TextReplace'
  • Assign object instance to global variable, $c2c_text_replace, to allow for external manipulation
  • Remove docs from top of plugin file (all that and more are in readme.txt)
  • Change description
  • Update readme
  • Minor code reformatting (spacing)
  • Add Filters and Upgrade Notice sections to readme.txt
  • Add .pot file
  • Update screenshot
  • Add PHPDoc documentation
  • Add package info to top of file
  • Update copyright date
  • Remove trailing whitespace


  • Fixed path-related issue for options page
  • Added 'Settings' link for plugin on admin Plugins page
  • Changed permission check
  • More localization-related work
  • Minor code reformatting (spacing)
  • Removed hardcoded path
  • Updated copyright
  • Noted compatibility through 2.8+
  • Dropped compatibility with versions of WP older than 2.6


  • Handled case where shortcut appears at the very beginning or ending of the text
  • Created its own class to encapsulate plugin functionality
  • Added an admin options page
  • Added option text_replace_comments (defaulted to false) to control whether text replacements should occur in comments
  • Tweaked description and installation instructions
  • Added compatibility note
  • Updated copyright date
  • Added readme.txt and screenshot
  • Tested compatibility with WP 2.3.3 and 2.5


  • Moved the array $text_to_replace outside of the function and into global space
  • Renamed function from text_replace() to c2c_text_replace()
  • Added installation instruction and notes to plugin file
  • Verified that plugin works for WordPress v1.2+ and v1.5+


  • Added optional argument $case_sensitive (defaulted to "false")
  • Changed from BSD-new to MIT license


  • Removed the need to escape special characters used in the shortcut text. Now "?", "(", ")", "[", "]", etc can be used without problems. However, the backspace character "\" should be avoided.
  • Employed a new pattern for matching and replacing text. A huge advantage of this new matching pattern is that it won't match text in a tag (text appearing between "<" and ">").


  • Initial release

Requires: 4.1 or higher
Compatible up to: 4.5.4
Last Updated: 4 months ago
Active Installs: 4,000+


4.3 out of 5 stars


1 of 3 support threads in the last two months have been marked resolved.

Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
0,1,0 100,1,1
100,1,1 40,5,2
0,1,0 100,1,1