Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tests for Search highlight & Fix issue where EP returns incorrect excerpt #3114

Merged
merged 6 commits into from
Nov 8, 2022

Conversation

burhandodhy
Copy link
Contributor

Description of the Change

This PR fixes the issue where EP returns the incorrect excerpt when the Excerpt highlighting option is enabled and get_the_excerpt is called without the Post Loop.

Closes #3101

How to test the Change

  1. Enable Excerpt highlighting option
  2. Create a post and leave the excerpt empty
  3. Search for that post through the code.
        $posts = get_posts( [ 's' => 'searchTerm' ] );
	var_dump( get_the_excerpt( $post[0] ) );

Changelog Entry

Fixed - Incorrect Excerpt when get_the_excerpt is called without Loop and Excerpt highlighting option is enabled

Credits

Props @burhandodhy

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@felipeelia felipeelia added this to the 4.4.0 milestone Nov 8, 2022
@felipeelia felipeelia merged commit dcbdb7f into develop Nov 8, 2022
@felipeelia felipeelia deleted the burhan/unit-test-for-highlight-search branch November 8, 2022 16:01
rebeccahum added a commit to Automattic/ElasticPress that referenced this pull request Nov 9, 2022
rebeccahum added a commit to Automattic/ElasticPress that referenced this pull request Nov 9, 2022
rebeccahum added a commit to Automattic/ElasticPress that referenced this pull request Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Incorrect excerpt when Excerpt highlighting is enabled
2 participants