Site logo

[Resolved] How To Fix Excerpt Text In RSS Feed

Home Forums Support [Resolved] How To Fix Excerpt Text In RSS Feed

Home Forums Support How To Fix Excerpt Text In RSS Feed

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2505276
    Rachel

    Hi there
    I use the following snippet to add the Read more linked text to my manual excerpts on the site, but the issue is in my RSS feed which I use to send automated emails to my list – the Read more text appears after the excerpt text on the RSS post description (unlinked – see below example).
    Current Snippet:
    add_filter( ‘wp_trim_excerpt’, ‘tu_excerpt_metabox_more’ );
    function tu_excerpt_metabox_more( $excerpt ) {
    $output = $excerpt;

    if ( has_excerpt() ) {
    $output = sprintf( ‘%1$s %3$s‘,
    $excerpt,
    get_permalink(),
    __( ‘Read more’, ‘generatepress’ )
    );
    }

    return $output;
    }

    RSS Feed Excerpt Text Example:
    This is my manual excerpt text. Read more The post Title Of Post appeared first on Site Name.

    How can I remove the read more text which appears between the excerpt and the final sentence in my RSS description?

    Thanks,
    Rachel

    #2505686
    David
    Staff
    Customer Support

    Hi there,

    in your snippet, this line:

    if ( has_excerpt() ) {

    change to:

    if ( has_excerpt() && ! is_feed() ) {

    This will check if it is NOT (!) the feed, before adding your read more

    #2506541
    Rachel

    Great that seems to have worked – thanks for the help David!

    #2506972
    David
    Staff
    Customer Support

    You’re welcome

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.