1

I am running into an issue with Gutenberg where I want to display the excerpt of a post, even when the excerpt field isn't filled in. Usually the functionality of WordPress is when the excerpt is empty to grab the first few lines of text from the content editor. With Gutenberg however when it does that it injects the page with additional HTML Elements, mainly p tags, screwing up the rest of the page.

If I add an excerpt manually in that post's excerpt field this issue is resolved and additional HTML elements aren't injected. But I can't rely on my client to always fill out the excerpt field, so I am trying to find a solution where I can use:

get_the_excerpt();

And if the excerpt field isn't filled out pull just text from the Gutenberg editor and not additional HTML elements. I assume this issue is with how Gutenberg works with the content editor containing everything in one.

Has anyone else ran into this issue and knows of a solution for this?

  • This sounds like a core bug, have you raised a ticket on Trac so it gets fixed in the next release? As an aside, I've had no issues with that function in 5.0 – Tom J Nowell Dec 12 '18 at 19:50
  • Alternatively to Trac you could raise an issue on the Gutenberg github repository. – majick Dec 13 '18 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.