-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Enqueue comment-reply script when post-comments-form block gets rendered #28826
Conversation
Size Change: -266 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
I have not tested the PR yet, I wanted to add that this is the issue: #24044 |
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.
LGTM, the script is enqueued when it is needed.
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.
LGTM code wise
Description
All WordPress themes are required to enqueue the
comment-reply
script.They usually do this by adding code like this:
In FSE themes we should automatically enqueue the script when needed instead of requiring authors to write PHP.
Types of changes
This PR adds the script in
wp_footer
when thepost-comments-form
block gets rendered.EDIT: Turns out
wp_enqueue_script()
works.Due to the nature of blocks rendering, thewp_enqueue_script()
function could not be used here, so instead of that, the PR adds the script in$wp_scripts
.How has this been tested?
Tested with an FSE theme and verified that when the block exists in a page, the script gets properly enqueued in the footer.
Checklist: