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

BUG: Incorrect excerpt when Excerpt highlighting is enabled #3101

Closed
burhandodhy opened this issue Nov 1, 2022 · 0 comments · Fixed by #3114
Closed

BUG: Incorrect excerpt when Excerpt highlighting is enabled #3101

burhandodhy opened this issue Nov 1, 2022 · 0 comments · Fixed by #3114
Assignees
Labels
bug Something isn't working
Milestone

Comments

@burhandodhy
Copy link
Contributor

burhandodhy commented Nov 1, 2022

Describe the bug

When the Excerpt highlighting is enabled, we call the get_the_excerpt function outside of the loop for the different post. It returns the excerpt of the post of main loop. This happened because get_the_content is looking for the content of main loop post.

Steps to Reproduce

  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] ) );
  1. Returns the excerpt of different post.

Expected behavior

Should return the excerpt of correct post.

Additional context

@burhandodhy burhandodhy added the bug Something isn't working label Nov 1, 2022
@burhandodhy burhandodhy added this to the 4.4.0 milestone Nov 1, 2022
@burhandodhy burhandodhy self-assigned this Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant