Skip Rendering Off-Screen Comments and Footers Until Needed
Uses the CSS content-visibility property so browsers skip laying out the comments section, footer and related posts until the visitor scrolls near them, which speeds up rendering of long pages.
Opens WPIDE on
Code
#comments,
.comments-area,
.wp-block-comments,
.site-footer,
footer.wp-block-template-part,
.related-posts,
.jp-relatedposts {
content-visibility: auto;
contain-intrinsic-size: auto 800px;
}
Notes
Adjust the selectors to your theme; the size hint keeps the scrollbar from jumping.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.