You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related Posts: Remove the call to remove_filter( 'the_content'… (#13804)
Fixes#13775
The filter 'filter_add_target_to_dom()' removes itself from the 'the_content'
hook. Then, a bug in Core causes the filter with the next highest priority to
be skipped.
For more information on the Core bug see: https://core.trac.wordpress.org/ticket/9968
To avoid this bug, remove the call to "remove_filter( 'the_content', array( $this,
'filter_add_target_to_dom'), ...)". Instead, just rely on conditionals in the
'filter_add_target_to_dom()' method to control when related posts are added to the
content.
Related posts should not be added to the content under these three condtions:
1. The post contains a Related Posts block.
2. The post contains a 'jetpack-related-posts' shortcode.
3. The 'get_the_excerpt' hook is being executed. This hook is executed when the related
posts are being generated, and related posts should not be added to the related post
content.
These conditions are already handled by the 'filter_add_target_to_dom()' method. However,
legacy related posts are currently added to posts that contain a Related Posts block. Fix this
by removing the $content parameter from "has_block('jetpack/related-posts', $content)".
0 commit comments