CM Search and Replace (CMSR) - Replacement Rules
By default, the 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: CM Search and Replace (CMSR) - Saving Changes to the Database
Navigate to Admin Dashboard → Search & Replace → Settings → Replacement Rules tab.
On the top of the tab you can find the search field and two checkboxes "from" and "to". It will help you to search and navigate between multiple replacement rules that you can create.
Lower is located a list with the replacement rules that you've created.
There are options to change:
- From String / To String - Which string will be searched and then replaced.
- Case - If enabled, the rule will be case sensitive (e.g. will differentiate "a" and "A").
- Regex - If enabled, the From String and To String fields will be parsed for Regex rules. Learn more: Using Regex.
- Pause - If enabled, the rule will not be applied. Useful for testing.
- Add restrictions / Locations - Learn more below.
- Update - Update the rule after you've changed something.
- UpdateDb - Clicking on this button will commit the changes straightly in the database. Learn more: Saving Changes to the Database.
- View & UpdateDb - Clicking on this button will show you the list of all articles where the permanent database changes will be committed. Under the list of articles you will see the button for committing the changes in the database. Learn more: Saving Changes to the Database. Note: this feature was introduced in version 1.4.6.
- Delete - Delete the rule.
The plugin allows to restrict each rule in three ways:
Click on the box for Add Timeframe.
A new box appears to set a date and time for the restriction.
Setting the dates means that this rule will be applied only between the date range defined in the restriction.
You can add more than one 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.
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.
Click on the box for Add Exclusion
A new box appears with set of checkboxes.
Each of the checkboxes allows to exclude given rule from working in associated area. For example, checking Site Title means that, even if the General Settings say otherwise, this rule will not work in titles.
- All - All content will be considered.
- Include - You can define specific posts or pages where the rule will be applied despite the General Settings.
- Exclude - You can define specific posts or pages where the rule will not be applied despite the General Settings.
Select one or multiple posts or pages.
Reorder Rules using Drag and Drop
The 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.
Define Number of Rules Per Page
You can add pagination support or display all rules on one screen using the settings found under the Settings tab.
Adding More Rules
Under the list of created rules, you can find the form for creating a new rule. Just fill all needed information, configure the options and click the Add New Rule button.
To save the changes, click on the Save Changes button at the bottom of the page.
Under the list of created rules, you can also find the button Save All Changes. It can be useful in case if you edit a few rules - there's no need to click Update for each that rule, you can just click the button Save All Changes to update all rules that you've edited at once.