Skip to main content
Agency Program Get 2× more leads and save 50% on hosting. Built for agencies ready to grow. Book a call
Text Replace icon

Text Replace

v4.0
by Scott Reilly · 4.4 (18 reviews)

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

4K+ active installs Updated Jul 12, 2021 Tested to 5.7.12
Try Demo Download
Pre-installed Ready in ~10s No card

About Text Replace

This plugin allows you to easily define shortcuts for text or HTML that can be used in your posts. It has additional features such as enabling text replacement for comments, making it case insensitive, and limiting it to one replacement per term per post. It's important to choose a shortcut that won't appear in your text to avoid undesired replacements.

Screenshots

Text Replace screenshot

Changelog

4.0 (2021-07-04)

Highlights:

This feature release adds a new setting to allow for user-specified filters to be processed, updates the plugin framework significantly, improves the plugin settings page, extracts developer docs from readme into new DEVELOPER-DOCS.md, restructures unit test files, notes compatibility through WP 5.7, and more.

Details:

  • New: Add new setting “More filters” to allow for user-specified filters to be processed for text replacements
  • New: Add get_default_filters() to return the default core and/or third-party filters processed by the plugin
  • Change: Update plugin framework to 064
    • 064:
    • New: For checkbox settings, support a ‘more_help’ config option for defining help text to appear below checkbox and its label
    • Fix: Fix URL for plugin listing donate link
    • Change: Store donation URL as object variable
    • Change: Update strings used for settings page donation link
    • 063:
    • Fix: Simplify settings initialization to prevent conflicts with other plugins
    • Change: Remove ability to detect plugin settings page before current screen is set, as it is no longer needed
    • Change: Enqueue thickbox during 'admin_enqueue_scripts' action instead of during 'init'
    • Change: Use is_plugin_admin_page() in help_tabs() instead of reproducing its functionality
    • Change: Trigger a debugging warning if is_plugin_admin_page() is used before 'admin_init' action is fired
    • 062:
    • Change: Update is_plugin_admin_page() to use get_current_screen() when available
    • Change: Actually prevent object cloning and unserialization by throwing an error
    • Change: Check that there is a current screen before attempting to access its property
    • Change: Remove ‘type’ attribute from style tag
    • Change: Incorporate commonly defined styling for inline_textarea
    • 061:
    • Fix bug preventing settings from getting saved
    • 060:
    • Rename class from c2c_{PluginName}_Plugin_051 to c2c_Plugin_060
    • Move string translation handling into inheriting class making the plugin framework code plugin-agnostic
      • Add abstract function get_c2c_string() as a getter for translated strings
      • Replace all existing string usage with calls to get_c2c_string()
    • Handle WordPress’s deprecation of the use of the term “whitelist”
      • Change: Rename whitelist_options() to allowed_options()
      • Change: Use add_allowed_options() instead of deprecated add_option_whitelist() for WP 5.5+
      • Change: Hook allowed_options filter instead of deprecated whitelist_options for WP 5.5+
    • New: Add initial unit tests (currently just covering is_wp_version_cmp() and get_c2c_string())
    • Add is_wp_version_cmp() as a utility to compare current WP version against a given WP version
    • Refactor contextual_help() to be easier to read, and correct function docblocks
    • Don’t translate urlencoded donation email body text
    • Add inline comments for translators to clarify purpose of placeholders
    • Change PHP package name (make it singular)
    • Tweak inline function description
    • Note compatibility through WP 5.7+
    • Update copyright date (2021)
    • 051:
    • Allow setting integer input value to include commas
    • Use number_format_i18n() to format integer value within input field
    • Update link to coffee2code.com to be HTTPS
    • Update readme_url() to refer to plugin’s readme.txt on plugins.svn.wordpress.org
    • Remove defunct line of code
  • Change: Allow displayed dropdown values for ‘when’ setting to be translated
  • Change: Improve settings page help text by adding, rephrasing, relocating, and tweaaking some formatting
  • Change: Change text_to_replace setting from being a textarea to inline textarea
  • Change: Move translation of all parent class strings into main plugin file
  • New: Add DEVELOPER-DOCS.md and move hooks documentation into it
  • New: Suggest Text Hover plugin as an option for those needing support for a specific subset use case
  • Change: Output newlines after block-level tags in settings page
  • Change: Omit ‘cols’ attribute for textarea since it is overridden
  • Change: Move ‘code’ tags out of translatable string for ‘when’ setting
  • Change: Note compatibility through WP 5.7+
  • Change: Update copyright date (2021)
  • Change: Improve documentation in readme.txt
  • Change: Tweak plugin’s readme.txt tags
  • Change: Sync installation instructions in README.txt with what’s in readme.txt
  • Change: Remove “A screenshot of” prefix from caption
  • Unit tests:
    • Change: Restructure unit test file structure
      • New: Create new subdirectory tests/phpunit/ to house all files related to PHP unit testing
      • Change: Move bin/ to tests/bin/
      • Change: Move tests/bootstrap.php into tests/phpunit/
      • Change: In bootstrap, store path to plugin file constant so its value can be used within that file and in test file
      • Change: Move tests from tests/ to tests/phpunit/tests/
      • Change: Remove ‘test-‘ prefix from unit test files
      • Change: Rename phpunit.xml to phpunit.xml.dist per best practices
    • New: Add unit tests for shortcuts adjacent to punction and special characters
    • Change: Output custom error message for known failing tests explaining the issues and why they may not actually be bugs
    • Change: Rename improperly named unit test
  • New: Add a few more possible TODO items
  • Change: Updated screenshot for settings page

3.9.1 (2020-07-11)

Highlights:

This minor release updates a bunch of documentation, updates a few URLs to be HTTPS, improves unit testing, and notes compatibility through WP 5.4+.

Details:

  • Change: Revamp a lot of the help text on the settings page
  • Change: Improve and expand upon documentation
  • Change: Note compatibility through WP 5.4+
  • Change: Update links to coffee2code.com to be HTTPS
  • Change: Add a number of new TODO items
  • Unit tests:
    • New: Add test for options_page_description()
    • New: Add test for setting name
    • Change: Remove unnecessary unregistering of hooks in tearDown()
    • Change: Remove duplicative reset_options() call
    • Change: Store plugin instance in test object to simplify referencing it
    • Change: Use HTTPS for link to WP SVN repository in bin script for configuring unit tests (and delete commented-out code)

3.9 (2020-01-15)

Highlights:

This feature release adds support for Advanced Custom Fields and Elementor, adds a new setting that can allow the plugin to run later to avoid potential conflicts with other plugins, adds a number of filters, updates compatibility to be WP 4.9-5.3+, and more.

Details:

  • New: Add support for third-party plugins: Advanced Custom Fields, Elementor
  • New: Add filter c2c_text_replace_third_party_filters for filtering third party filters
  • New: Add new setting to allow control over when text replacements are handled early or late in text processing process
  • New: Add filter c2c_text_replace_filter_priority for filtering hook priority for text replacement handler
  • Fix: Ensure the lack of any defined replacements doesn’t remove zeroes from text
  • Change: Alter handling of replace_once value to ensure a valid value is used as arg for preg_replace()
  • Change: Initialize plugin on plugins_loaded action instead of on load
  • Change: Remove plugin setting page help text indicating order matters (it hasn’t since v3.8)
  • Change: Update plugin framework to 050
    • 050:
    • Allow a hash entry to literally have ‘0’ as a value without being entirely omitted when saved
    • Output donation markup using printf() rather than using string concatenation
    • Update copyright date (2020)
    • Note compatibility through WP 5.3+
    • Drop compatibility with version of WP older than 4.9
    • 049:
    • Correct last arg in call to add_settings_field() to be an array
    • Wrap help text for settings in label instead of p
    • Only use label for help text for checkboxes, otherwise use p
    • Ensure a textarea displays as a block to prevent orphaning of subsequent help text
    • Note compatibility through WP 5.1+
    • Update copyright date (2019)
  • New: Add CHANGELOG.md and move all but most recent changelog entries into it
  • New: Add TODO.md and move existing TODO list from top of main plugin file into it (and add more items to the list)
  • New: Add inline documentation for hooks
  • Unit tests:
    • New: Add capture_filter_value() as a method for capturing default values provided for a filter
    • New: Add get_filter_names() as a helper method for getting the default and third-party filter names
    • New: Add unhook_default_filters() as a helper method to unhook plugin’s default filters hooked to text_replace()
    • New: Add tests for setting defaults
    • New: Add text_to_replace example values to verify replacement to 0 and an empty string are valid
    • New: Add failing tests for replacements affecting shortcode tags and shortcode attributes (though current behavior may be desired)
    • New: Add failing test for replacement text itself getting a replacement (though current behavior may be desired)
    • New: Add new test_does_not_replace_within_markup_attributes()
    • Change: Rename old test_does_not_replace_within_markup_attributes() to test_does_not_replace_within_markup_attributes_but_does_between_tags()
    • Change: Update unit test install script and bootstrap to use latest WP unit test repo
    • Change: Explicitly check hook priority when checking that hook is registered
    • Change: Update some inline docs and function names to reflect their relevance to this plugin (and not to the plugin they were copied from)
    • Fix: Fix unit test function name so that it is treated as a unit test
  • Change: Note compatibility through WP 5.3+
  • Change: Drop compatibility with version of WP older than 4.9
  • Change: Tweak some documentation in readme.txt
  • Change: Update copyright date (2020)
  • Change: Update License URI to be HTTPS
  • Change: Split paragraph in README.md’s “Support” section into two
  • Fix: Correct typo in GitHub URL

Full changelog is available in CHANGELOG.md.

Try other plugins

Classic Editor icon

Classic Editor

4.9 · 9M+ installs

Enables the previous "classic" editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports all…

WordPress Importer icon

WordPress Importer

3.1 · 3M+ installs

Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.

Classic Widgets icon

Classic Widgets

4.9 · 2M+ installs

Enables the previous "classic" widgets settings screens in Appearance - Widgets and the Customizer. Disables the block editor…