replace_first
Filter
Replace the first occurrence of a substring with a string.
Parameters
Parameter | Required | Description |
---|---|---|
search
|
Yes |
string String to replace.
|
replacement
|
Yes |
string Replacement string.
|
Category
Description
The replace_first
filter replaces the first occurrence of a given substring with a
replacement string. The first argument is the substring to search for, and the second argument is
the replacement string for the first match of the search string.
If you want to replace all occurrences of a substring, use the
replace
filter
instead.