0

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');
  • If you're filtering the content you need to return $content; at the end, just before your function's closing }. – WebElaine Jun 22 '18 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.