[wp-trac] [WordPress Trac] #56425: wp_localize_script assign to const and freeze instead of var to avoid reassignments
WordPress Trac
noreply at wordpress.org
Tue Nov 8 07:36:06 UTC 2022
#56425: wp_localize_script assign to const and freeze instead of var to avoid
reassignments
-----------------------------------+------------------------------
Reporter: malthert | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version:
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses: javascript
-----------------------------------+------------------------------
Comment (by kkmuffme):
>myPluginVar.KEY = myPluginVar.KEY || 'My Default Value'
Which defeats the purpose of localizing in the first place, so this is a
bad practice.
>wp.i18n
Definitely!
Still we shouldn't neglect what is there in tons of sites and strive on
keeping this as secure as possible, as legacy code often is the first
point of attack.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56425#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list