Find and Replace Words in Post Content For Specific category

I have tried my best it is still giving me blank page. My goal is to Find and Replace words in post content article for one or two specific category, Not the entire site.

function specific_category_postsfilter($content) {

if (is_single() && in_category(‘Uncategorized’)) {
$old_word = ‘Listen Below’;
$new_word = ‘Just Now’;
str_replace($old_word, $new_word, $content);
}
}
add_filter(‘the_content’, ‘specific_category_postsfilter’);

Read more here:: Find and Replace Words in Post Content For Specific category

Leave a Reply

Your email address will not be published. Required fields are marked *