Search Results only show exerpts from posts and events, not pages

Hi there!

When I search, I’d like to see the page text around the search term, but that only works for results in a post or an event.

For example, when I search for “addictions” I see results for both pages and posts, but only the posts show the context around the term:

Page results:

Can you help me understand why it’s doing this?

Thanks!

Hey David,

Pages don’t have an Excerpt in WordPress. It would need custom coding or a plugin to enable the Excerpt feature for the Page post type. This is beyond the scope of our theme support. You can try following this third-party tutorial instead: https://www.wpbeginner.com/plugins/add-excerpts-to-your-pages-in-wordpress/

If that doesn’t help, please hire a developer to enable page excerpt in your site.

Thanks.

Thanks Christian. What I meant to ask is not for the ability to write excerpts for pages, but to be able to see the context a search result.

What I’d like to do is: If I searched for “toy” and the word “toy” appeared on one of my pages, would it be possible to, in the search results see the sentence in which that word appeared?

Hello David,

Because of the absence of the excerpt functionality for the pages, you cannot display any excerpt on the search results. You will have to add the functionality in your pages first and then it will display the page excerpts in search results.

The link shared by @Christian is a great way to start with the modification to add the excerpt functionality for the pages.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.