Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Remove/hide specific word from excerpt?

Discussion in 'Misc WordPress Requests' started by Steve Stern, Oct 22, 2017.

  1. Steve Stern

    Guest

    Reply To: Remove/hide specific word from excerpt?, by Steve Stern

    Something like this… NOTE: THIS IS NOT TESTED ad may or may not work. YOU MAY HAVE TO DEBUG.

    function my_clean_excerpt( $excerpt ) {
    $badwords = array(
    'word1',
    'word2',
    'word3',
    );
    foreach ( $badwords as $badword ) {
    $excerpt = str_replace( $badword, '', $excerpt);
    }
    return $excerpt;
    }
    add_filter( 'get_the_excerpt', 'my_clean_excerpt' );

    Reply To: Remove/hide specific word from excerpt?
     
    #1

Share This Page

Web Hosting