Search and Replace Plugin (CMSR) - Replacement Rules
Replacement Rules
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.
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.
Below the search bar there's a button Add New S&R Rule which shows or hides a 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:
The options for each rule are:
- Search For - Enter here the content you want to replace.
- 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.
- Location - Here you can define the content area where to apply the rule. There are a few options:
- All - The replacement rule will be applied to all post types selected in the General Settings.
- Include - The replacement rule will be applied only to selected posts/pages. Custom post types are supported.
- Exclude - The replacement rule will be applied to all posts/pages, except the selected ones. Custom post types are supported.
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:
- 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.
- Regex - If enabled, the Search For field will be parsed for Regex rules. Learn more: Using Regex.
- 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:
- Site Title
- Page Title
- Content
- Excerpt
- Links (this restriction was introduced in version 1.5.9)
- Images (this restriction was introduced in version 1.6.1)
- Comments
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.
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.
- Pause - If enabled, the rule will not be applied.
- Add Rule - Click this button to create a rule.
Once the rule is created, it has a few more options:
- Update Rule - If you make any changes in the rule, click this button to save the changes.
- Change in Database - Clicking on this button will commit the changes straightly in the database. Learn more: Saving Changes to the Database.
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.
- Delete Rule - Click this button to delete the rule.
Rules Order
You can see a list of all created rules below the search bar:
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:
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:
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 |