WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to display an excerpt of a page inside an enhanced widget.

I have tried the following but it doesn't work:

$id = 2550;
$post = get_post($id);
$content = apply_filters('the_content', $post->post_excerpt);
return  $content;
share|improve this question


apply_filters( 'get_the_excerpt', $post->post_excerpt )

This will fill the excerpt with the first words from post_content when there is no excerpt, because the default filters will take care of that.

share|improve this answer
I get the following error: Parse error: syntax error, unexpected T_RETURN in /var/www/localhost/wp-content/plugins/enhanced-text-widget/enhanced-text-widget.‌​php(53): eval()'d code on line 8 – James H May 1 '13 at 18:49
@JamesH That’s a separate syntax error. – toscho May 1 '13 at 18:50
Any thoughts on how to debug this? – James H May 1 '13 at 18:58
No idea, I don’t know your new source code. Update your question please. – toscho May 1 '13 at 18:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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