• Resolved Colby Ross

    (@colby-ross)


    Hi, I’m looking for something I can add to the functions.php file to completely all excerpts from the homepage, archives, etc. All code I’ve tried previously have failed to work. I’d like to do this with the functions.php file rather than CSS or a plugin to avoid extra overhead. Thank you.

    • This topic was modified 5 years, 2 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi

    use the below code paste it in the functions file

    function new_excerpt($more) {
    global $post;
    remove_filter(‘the_excerpt’, ‘new_excerpt’);
    return ”;
    }
    add_filter(‘the_excerpt’,’new_excerpt’,11);

    Thank you
    Praveen Valmiki

    @colby-ross please check the Single quote before you use the code

    @colby-ross , you can try this function:

    function trim_excerpt($text)
    {
    return '';
    }
    add_filter('get_the_excerpt', 'trim_excerpt');;

    Note:If you are working with main/parent theme,first create child theme of parent theme and then modify functions.php

    Hope this helps you ??

    Thanks
    Suman W.

    • This reply was modified 5 years, 2 months ago by Suman.

    Hello colby-ross,

    Try this and let me know if this helped

    function custom_excerpt_length( $length ) {
    return 0;
    }
    add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 );

    Thanks,
    Kartik

    Thread Starter Colby Ross

    (@colby-ross)

    @vpraveen60 and @sumanm – thank you, but neither of the codes provided worked for me.

    @colby-ross

    Modify function code and set priority,

    
    function trim_excerpt($text)
    {
    return '';
    }
    add_filter('get_the_excerpt', 'trim_excerpt',40);
    • This reply was modified 5 years, 2 months ago by Suman.
    Thread Starter Colby Ross

    (@colby-ross)

    @sumanm Thanks for the code. Unfortunately, it only seems to get rid of the excerpt from the very first post as you can see. I’ve left the code in so you can take a look.

    Thread Starter Colby Ross

    (@colby-ross)

    I’ve managed to solve the problem. I realized that my theme has a hidden option to change the excerpt length. A conflict with the theme could have been causing the codes mentioned previously from working properly.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Removing post excerpts completely’ is closed to new replies.