Search and Replace Plugin (CMSR) - Replacement Rules


Replacement Rules

Back to User Guide

Permanent Changes?

By default, the Search and Replace plugin does not make permanent changes to your content.

Once you create replacement rules, they will be applied to visitors only while they access the page.

Learn about saving changes permanently: Search and Replace Plugin (CMSR) - Saving Changes to the Database

Navigate to Admin Dashboard â†’ Search & Replace â†’ Settings â†’ Replacement Rules tab. 

Navigation to the dashboard for managing replacement rules - WordPress Plugin Search and Replace
Navigation to the dashboard for managing replacement rules

On the top of the tab you can find the search field and two checkboxes "For" and "By". It will help you to search and navigate between multiple replacement rules that you can create.

Bar for searching the replacement rules - WordPress Plugin Search Database and Replace
Bar for searching the replacement rules

Below the search bar there's a button Add New S&R Rule which shows or hides a form for creating rules:

Form for creating rules - Find and Replace Plugin WordPress
Form for creating rules

The form by default shows only basic options. More options can be shown or hidden by clicking Expand / Collapse Additional Settings:

Expanding additional settings - WordPress Plugin to Mass Replace Links
Expanding additional settings

The options for each rule are:

Additional settings - Mass Replace Text in WordPress
Additional settings
  1. Search For - Enter here the content you want to replace.
  2. Replace By - Enter here the content that you want to displayed instead of the searched content. These 2 options allow creating restriction rules. For example, you can easily replace WordPress Blog by WordPress News by entering the values into the fields. You can also edit links, replace HTML, and more.
  3. Location - Here you can define the content area where to apply the rule. There are a few options:
    1. All - The replacement rule will be applied to all post types selected in the General Settings.
    2. Include - The replacement rule will be applied only to selected posts/pages. Custom post types are supported.
    3. Exclude - The replacement rule will be applied to all posts/pages, except the selected ones. Custom post types are supported.
    4. Categories/Tags - The replacement rule will be applied to all posts that relate to the chosen categories or tags.

      Once you choose any option except All, a new option will appear on the right side. It allows you to choose either posts/pages or categories/tags:

      Choosing location - WordPress Plugin Search and Replace
      Choosing location
  4. Case-sensitive - Enable it if you want values in the field Search For to be case-sensitive. This feature allows you to distinguish between uppercase and lowercase letters. For example, if you enter Home into the Search For field, the plugin will replace this word with the uppercase letter H only.
  5. Regex - If enabled, the Search For field will be parsed for Regex rules. Learn more: Using Regex.
  6. Exclusions - This option allows to to not apply the rule to the associated area. For example, checking Site Title means that, even if the General Settings say otherwise, this rule will not work in titles. The list of available ecxlusions are:
    1. Site Title
    2. Page Title
    3. Content
    4. Excerpt
    5. Links (this restriction was introduced in version 1.5.9)
    6. Images (this restriction was introduced in version 1.6.1)
    7. Comments
  7. Timeframe - Setting the dates and time means that this rule will be applied only between the date and time range defined in the restriction. You can add more than one timeframe. To delete the timeframe, click the "x" button, and to add one more timeframe, click the "+" button.

    Adding timeframe - WordPress Plugin Search Database and Replace
    Adding timeframe

Important: when you set a date and time for the restriction, you need to know that this option works according to the Universal time - and it can be different from the local time that you set in your site settings. To check it, navigate to Admin Dashboard â†’ Settings â†’ General and scroll to the option Timezone.

Site timezone settings - Find and Replace Plugin WordPress
Site timezone settings

There are displayed Universal time and Local time.

For example, the case that you see on the screen we have a difference in 3 hours between universal and local time set on the site. So, if we want the replacement rule work from 12 to 13 o'clock according to the local time, we need to set the time in the Add Timeframe option from 9 to 10 o'clock.

  1. Pause - If enabled, the rule will not be applied.
  2. Add Rule - Click this button to create a rule.

Once the rule is created, it has a few more options:

Edit options - WordPress Plugin to Mass Replace Links
Edit options
  1. Update Rule - If you make any changes in the rule, click this button to save the changes.
  2. Change in Database - Clicking on this button will commit the changes straightly in the database. Learn more: Saving Changes to the Database.
  3. View Related Posts - Clicking on this button will show you the list of all posts and pages where the Search For rule is found. There you can choose all posts where you want to commit a replacement rule and add them to inclusion or exclusion lists using buttons Insert into Include and Insert into Exclude. You can also use a search bar in the appearing pop-up to filter related posts. Note: this feature was introduced in version 1.4.8.

    Checking the posts where the replacement rule is applied - Mass Replace Text in WordPress
    Checking the posts where the replacement rule is applied
  4. Delete Rule - Click this button to delete the rule.

Rules Order

You can see a list of all created rules below the search bar:

Created rules - Search and Replace Plugin
Created rules

When you create a new rule, it always appears at the top of the list of rules, where you can see it after the creation. After you refresh the page, the newly created rule goes to the bottom of the list. So the rules are ordered from oldest to newest:

Creating new rule - WordPress Plugin Search and Replace
Creating new rule

The Search and Replace plugin works on the rules in the order you set them. This is specially relevant if some of them overlap. You can reorder them at any time. Since the order of the rule has a great implications on the output of the content, you can change the order by using a drag and drop interface:

Changing the order of the replacement rules - WordPress Plugin Search Database and Replace
Changing the order of the replacement rules

More information about the Search and Replace Plugin for WordPress

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.