Hello devs,
**Task**: Override a certain word in the Elementor content. The replacement word is the same, but the first letter must be capitalized.
**Code**:
`function replace_word($content) {`
`if (has_filter(‘widget_text’)) {`
`$content = apply_filters(‘widget_text’, $content);`
`}`
`$content = str_replace(‘Word’, ‘word’, $content);`
`return $content;`
`}`
`add_filter(‘the_content’, ‘replace_word’, 10);`
**Explanation Code above:** This modified function first checks if the widget\_text filter exists, and if it does, it applies the filter to the content. Then it performs the text replacement. This should ensure that the function works for both standard WordPress content and Elementor content.
Unfortunately, this is not the case. Am I using the wrong hooks? I’m aware of the *elementor/frontend/the\_content* hook, but unfortunately this results in the same issue.
Thanks in advance for the help.
[ad_2]