Reputation: 3731
I am developing a plugin that is used to find and replace words. So far I have this code and it does not seem to work.
function replace_content($content){
$wp_post = get_the_content();
$content = str_replace('lorem',' ronny',$wp_post);
return $content;
}
add_filter('the_content','replace_content');
Any help will highly be appreciated.
Upvotes: 1
Views: 886
Reputation: 3731
Found the solution. The content was in capital letters, so i used the str_ireplace()
instead of str_replace()
function so as to ignore case.
Upvotes: 2