-
Notifications
You must be signed in to change notification settings - Fork 800
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
Related Posts: Fix bug that prevents related posts from displaying in AMP view #13273
Conversation
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: September 3, 2019. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me. 👍
@htdat Do you think you could give that patch a spin, since you had a test site where you were running into the issue?
Thank you!
cc @westonruter who may be interested in this as well. |
Fixes #13273 Check the $wp_current_filter array for 'get_the_excerpt' using doing_filter() to ensure that related posts aren't added to excerpts.
4335d9b
to
9fa6348
Compare
I've tested this. It is working very well for my site whether or not I activate Sharing and/or Publicize modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well for me too. Merging.
Caution: This PR has changes that must be merged to WordPress.com |
* 7.7 changelog: initial set of changes * Changelog: add #13154 * Changelog: add #13134 * Changelog: add #12699 and many others * Changelog: add #13127 * Changelog: add #13167 * Changelog: add #13225 * Changelog: add #13179 * Changelog: add #13173 * Changelog: add #13232 * Changelog: add #13137 * Changelog: add #13172 * Changelog: add #13182 * Changelog: add #13200 * Changelog: add #13244 * Changelog: add #13267 * Changelog: add #13204 * changelog: add #13205 * Changelog: add #13183 * Changelog: add #13278 * Changelog: add #13162 * Changelog: add #13268 * Changelog: add #13286 * Changelog: add #13273 * Changelog: add #12474 * Changelog: add #13085 * Changelog: add #13266 * Changelog: add #13306 * Changelog: add #13311 * Changelog: add #13302 * Changelog: add #13196 * Changelog: add #12733 * Changelog: add #13261 * Changelog: add #13322 * Changelog: add #13333 * Changelog: add #13335
Fixes #13260
This fixes a bug that prevents related posts from displaying in AMP view when the Sharing or Publicize modules are enabled. This bug is also present when the Yoast SEO plugin is activated.
In AMP view, the related posts are displayed by using a filter,
filter_add_target_to_dom()
, on thethe_content
hook here.That filter is removed in the
render_block
function So,filter_add_target_to_dom()
will only be called the first time thatthe_content
filters are applied.In the Publicize and Sharing modules, filters are applied to the
get_the_excerpt
hook early, and those filters apply thethe_content
filters. This causes thefilter_add_target_to_dom()
filter to be applied to thethe_content
hook before the content is actually being prepared. Then the filter is removed, so the filter isn't applied when it's needed.Changes proposed in this Pull Request:
filter_add_target_to_dom()
from callingrender_block()
whenget_the_excerpt
is in$wp_current_filter
.Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
Test on a site that has related posts.
Steps 3 to 10 should be repeated with the Standard AMP mode.
Proposed changelog entry for your changes: