Make WordPress Core

Opened 2 years ago

Last modified 11 months ago

#43733 new task (blessed)

Replace Underscores.js with Lodash.js

Reported by: ChopinBach Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: External Libraries Keywords: dev-feedback needs-patch
Focuses: javascript Cc:


Should we replace Underscores.js with Lodash.js?

Discussed in Slack today (April 10th, 2018).

It was suggested for converting WP Core to lodash, jscodeshift could be leveraged.

Here is a list of API pairings between lodash and underscores.


Lodash 5.0 is set to have some backwards incompatible changes that could make the migration awkward.

General backwards compatibility concerns as well. How do we want to handle Backwards Compat? Most likely only core will be changed, and a migration path/tool will be offered out to theme/plugin authors.

Change History (9)

This ticket was mentioned in Slack in #core-js by chopinbach. View the logs.

2 years ago

#2 @johnbillion
2 years ago

  • Keywords dev-feedback added

Can someone summarize the reasons for switching?

#3 @johnbillion
2 years ago

  • Focuses javascript added

#5 @netweb
2 years ago

  • Type changed from enhancement to task (blessed)

#6 @adamsilverstein
2 years ago

@johnbillion quick summery: since Gutenberg has chosen to use lodash, we should switch core's usage over as well when possible to avoid loading duplicate, redundant libraries. For example, using media in Gutenberg means we are loading both lodash and underscore.

#7 @sc0ttkclark
20 months ago

Just a friendly reminder from your neighborhood plugin developer that you'll want to replace underscore usage in core with lodash, but leave underscore as a registered script while noting in the official WP release that it has been deprecated and will be removed in WP 5.x (whatever version that might be) -- so that plugins using underscore can continue to remain compatible with this upcoming major WP release while they make the transition.

This ticket was mentioned in Slack in #core-js by adamsilverstein. View the logs.

19 months ago

#9 @Hareesh Pillai
11 months ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.