the_excerpt_rss()

Displays the post excerpt for the feed.

Source

function the_excerpt_rss() {
	$output = get_the_excerpt();
	/**
	 * Filters the post excerpt for a feed.
	 *
	 * @since 1.2.0
	 *
	 * @param string $output The current post excerpt.
	 */
	echo apply_filters( 'the_excerpt_rss', $output );
}

Hooks

apply_filters( ‘the_excerpt_rss’, string $output )

Filters the post excerpt for a feed.

Changelog

VersionDescription
0.71Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example

    To create a custom feed that takes a GET parameter on a URL (e.g. http://www.example.com/?feed=myfeed&type=excerpt), place something like the following in your particular feed file to send an excerpt (the_excerpt_rss() ) instead of the full content (the_content()):

    if isset( $_GET['type'] ) ) {
    	$typewanted = sanitize_text_field( $_GET['type'] );
    }
    
    if ( $typewantd == 'excerpt' ) {
    	// Wrap the Excerpt in a span tag for CSS styling
    	echo '<span class="excerpt">'; 
    		the_excerpt_rss();   
    	echo '</span>';
    } else {  
    	// Otherwise they want the full content so wrap it in another span
    	echo '<span class="content">';
    		the_content();
    	echo '</span>';
    }

You must log in before being able to contribute a note or feedback.