When trying to call get_the_excerpt() the page does not return anything on posts that have no excerpt.

I thought WordPress usually 'fake' it and create one using the first x characters from the_content().

Or have things changed?

2 Answers 2


Double check that you don't have a check for has_excerpt() that's hiding the "auto-generated" excerpt. Even if get_the_excerpt() returns something made from post_content, has_excerpt() still returns false if the excerpt is empty.

If that's not the case, see if there's a function that filters on get_the_excerpt that could be effecting this.

To answer your question, wp_trim_excerpt(), the function that "fakes" an excerpt, filters get_the_content() which the_excerpt() is just a wrapper function for. So that's not the issue.

  • Theres no has_excerpt() condition before I print get_the_excerpt(). Although I have still checked the functions file and there is nothing that I can see that could be filtering get_the_excerpt.
    – Imran
    Commented Oct 4, 2012 at 23:02
  • Does it work if you use the_excerpt()?
    – mrwweb
    Commented Oct 5, 2012 at 1:20
  • Also having this problem - is there a solution?
    – benedict_w
    Commented Dec 20, 2014 at 13:28

In my case, I had,

function mytheme_excerpt_length() {

and POST_EXCERPT_LENGTH was defined somewhere, which got deleted by mistake. So, excerpt was returning 0 characters.

So, just return a value greater than 0 and it should fix the issue.

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.