[wp-trac] [WordPress Trac] #54018: Allow scripts registered via block.json to be enqueued in the footer
WordPress Trac
noreply at wordpress.org
Mon Oct 6 11:59:46 UTC 2025
#54018: Allow scripts registered via block.json to be enqueued in the footer
---------------------------+--------------------------
Reporter: jeremyfelt | Owner: (none)
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.9
Component: Script Loader | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: performance
---------------------------+--------------------------
Comment (by gziolo):
I wanted to note that the PR attached proposes two top-level properties in
`block.json`:
- `enqueueEditorFooter`
- `enqueueScriptFooter`
It doesn't cover view scripts and view script modules. It also doesn't
consider the case that there might be multiple scripts per every type. It
also doesn't take into account `fetchpriority`.
The comment from @ocean90
https://core.trac.wordpress.org/ticket/54018#comment:5 contains the best
possible path forward as it allows targeting individual assets. In fact,
we could mirror the same behavior in the `.asset.php` files so they
contains all the details that is needed to optimize these assets, example:
{{{#!php
<?php return array(
'handle' => 'my-editor-script',
'dependencies' => array('wp-dom-ready', 'wp-i18n'),
'version' => '11d702108040f841d934',
'fetchPriority' => 'low',
'inFooter' => true,
);
}}}
The same details in `block.json` if you only want to override
`fetchPriority`:
{{{#!json
{
"editorScript": [ {
"handle": "my-editor-script",
"fetchPriority": "low"
} ]
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54018#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list