The standard way of getting an excerpt is to use the_excerpt() or get_the_excerpt() template tags. I am trying to get just the actual content of the Excerpt field.

If there is an excerpt, I want to display it in full (without being abridged or appending [...]). If there is no excerpt, I don't want anything to be displayed.

Is there a straightforward way to do this in Wordpress?

Something like this:

$real_excerpt = ??? 

if ( $real_excerpt ) {
   echo $real_excerpt;
} // shouldn't show anything if there isn't a custom excerpt

2 Answers 2


Why don't you use the global $post variable? It contains an object with the content as it is on the db row corresponding to that post. Here's how to use it:

global $post; // If for some reason it's readily accessible, invoke it
if($post->post_excerpt != '') {


$my_post = get_post($post_id);
if($my_post->post_excerpt != '') {

Very simple, but let us know if you're having trouble getting it working.

  • 1
    While Kaiser's thoughts provided a lot of insight, your first snippet was enough to create a simple function so selectively display the unfiltered excerpt. Thanks!
    – MTT
    Commented Dec 18, 2012 at 18:37
  • Awesome! For me, the first snippet worked too! Thanks. Commented May 22, 2019 at 14:40

Tracing back:


When you look at the source of the_excerpt(), then you'll find the following function definition:

function the_excerpt() {
    echo apply_filters('the_excerpt', get_the_excerpt());

This means, that get_the_excerpt() holds the plain, unfiltered content.


When you then look at the source of get_the_excerpt(), you'll find the following:

function get_the_excerpt( $deprecated = '' ) {
    if ( !empty( $deprecated ) )
        _deprecated_argument( __FUNCTION__, '2.3' );

    global $post;
    $output = $post->post_excerpt;
    if ( post_password_required($post) ) {
        $output = __('There is no excerpt because this is a protected post.');
        return $output;

    return apply_filters('get_the_excerpt', $output);

So there're again filters added to get_the_excerpt().

Default filters & wp_trim_excerpt()

All the core filters, that are attached to something, can be found inside ~/wp-includes/default-filters.php.

There you'll find (with WP version 3.4), the following filter: wp_trim_excerpt() on Line #147.

The wp_trim_excerpt() function looks like the following from its inside:

function wp_trim_excerpt($text = '') {
    $raw_excerpt = $text;
    if ( '' == $text ) {
        $text = get_the_content('');

        $text = strip_shortcodes( $text );

        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]>', $text);
        $excerpt_length = apply_filters('excerpt_length', 55);
        $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
        $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);

What are our options?

You could use each of those functions with all their unwanted filters, by simply removing the filters. But this also means, that you'd be removing them from everything else as well.

Calling the plain ->excerpt, gives you an excerpt in every case - except if there is none. Which means, that you can insert scripts and CDATA tags as explained in this answer, but will also have to deal with the post password check, as well as moving back in all the filters that you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.