Skip to content

Commit

Permalink
Load comment-reply script with defer loading strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jul 11, 2023
1 parent 7e469ec commit 23b7aad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/block-library/src/comments/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function render_block_core_comments( $attributes, $content, $block ) {
* why they are not defined in `block.json`.
*/
wp_enqueue_script( 'comment-reply' );
wp_script_add_data( 'comment-reply', 'strategy', 'defer' );
enqueue_legacy_post_comments_block_styles( $block->name );

return sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $output );
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comments-form/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {

// Enqueue the comment-reply script.
wp_enqueue_script( 'comment-reply' );
wp_script_add_data( 'comment-reply', 'strategy', 'defer' );

return $form;
}
Expand Down

0 comments on commit 23b7aad

Please sign in to comment.