-
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
Use Jetpack_RelatedPosts::get_options() to get options for server-rendered Related Posts #14386
Use Jetpack_RelatedPosts::get_options() to get options for server-rendered Related Posts #14386
Conversation
…dered Related Posts This ensures that options are normalized and that they can be filtered via jetpack_relatedposts_filter_options.
This is an automated check which relies on |
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.
Good catch! LGTM
Caution: This PR has changes that must be merged to WordPress.com |
* [not verified] Remove empty readme section * Initial changelog for 8.2 * Changelog: add #14220 * Changelog: add #14252 * Changelog: add #14291 * Changelog: add #14309 * Changelog: add #14304 * Changelog: add general connection log. * Changelog: add #14275 * Changelog: add #14313 * Changelog: add #14213 * Changelog: add #14357 * Add sync testing instructions * Add 8.1.1 changelog back See eeaafab and 61757eb * Changelog: add #14371 * Changelog: add #14386 * Changelog: add #14471 * Changelog: add #14325 * Changelog: add #14194 * Changelog: add #14340 * Changelog: add #14418 * Changelog: add #14417 * Changelog: add #14075 * Changelog: add #14467 * Changelog: add #14307 * Changelog: add #14326
It was discovered by @jamesozzie that filtering options for rendering Related Posts does not work on AMP pages. For example, in response to a support forum topic he was looking to reduce the number of posts displayed from 3 to 2 with code like so:
This turned out not to work because AMP pages render the Related Posts using
Jetpack_RelatedPosts::get_server_rendered_html()
and this method was callingJetpack_Options::get_option( 'relatedposts', array() )
rather thanJetpack_RelatedPosts::get_options()
, and only the later method applies thejetpack_relatedposts_filter_options
filter (as well as apply other normalizations).This PR updates
\Jetpack_RelatedPosts::get_server_rendered_html()
to useJetpack_RelatedPosts::get_options()
rather than the lower-levelJetpack_Options::get_option( 'relatedposts', array() )
.Issue introduced in Jetpack 7.6 via #13028 for #9556.
Changes proposed in this Pull Request:
Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
jetpackme_more_related_posts
filter to change thesize
(see above).Proposed changelog entry for your changes:
Jetpack_RelatedPosts::get_options()
to get options for server-rendered Related Posts