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

fix: do not apply the_content filter to homepage post excerpts #883

Merged
merged 1 commit into from
Sep 28, 2021

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Sep 28, 2021

All Submissions:

Changes proposed in this Pull Request:

Removes the the_content filter applied to excerpts generated for Homepage Posts blocks, since it might result in unwanted behavior if other plugins are using that same filter.

How to test the changes in this Pull Request:

  1. On master, temporarily add a function to your theme's functions.php to append some content on the the_content hook:
function newspack_test_content_filter( $content ) {
	$content .= ' And this is my appended text!';
	return $content;
}
add_filter( 'the_content', newspack_test_content_filter, 0 );
  1. Add a Homepage Posts block to a page and turn on "Show Excerpts". Observe that excerpts are affected by your test filter in the editor and on the front-end.
  2. Check out this branch, confirm that your excerpts are unaffected by the content filter.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added the bug Something isn't working label Sep 28, 2021
@dkoo dkoo requested review from laurelfulford and a team September 28, 2021 23:15
@dkoo dkoo self-assigned this Sep 28, 2021
Copy link
Contributor

@laurelfulford laurelfulford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to recreate this issue with the provided function, both on Custom excerpts and really short excerpts (so I could see the end of them in the block). This PR fixed both cases! 🚢

@dkoo dkoo merged commit aa9e667 into master Sep 28, 2021
@dkoo dkoo deleted the fix/no-content-filter branch September 28, 2021 23:28
matticbot pushed a commit that referenced this pull request Sep 28, 2021
## [1.39.1](v1.39.0...v1.39.1) (2021-09-28)

### Bug Fixes

* do not apply the_content filter to homepage post excerpts ([#883](#883)) ([aa9e667](aa9e667))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.39.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants