Use Excerpts returned from Elasticpress in Elementor Search Results Page #13354
gtdatagroup
announced in
Developers Community
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Elementor is returning the default Wordpress excerpt and not the excerpts created by Elasticpress, which I use for searches. By default Wordpress excerpt, I mean the excerpt created with the post or the first 75 words of the post. I really need the excerpts that are returned by Elasticpress that have the search terms in them.
I suspect that Elementor is just taking the post ID returned by ElasticPress and fetching the post again. When a WordPress post query goes through ElasticPress/Elasticsearch, it will use this function: https://github.com/10up/ElasticPress/blob/develop/includes/classes/Indexable/Post/QueryIntegration.php#L192 (Indexable/Post/QueryIntegration::get_es_post())
Near the end of that method, the "ep_wp_query" action could be used to temporarily store the post excerpt with terms highlighted as they came from Elasticsearch. Then, in Elementor's code, I would need to find a filter to replace the excerpt Elementor is getting with the temporary version.
I would be happy to hire someone to develop this for me.
Beta Was this translation helpful? Give feedback.
All reactions