Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@wordpress/data

WordPress624kGPL-2.0-or-later10.22.0TypeScript support: included

Data module for WordPress.

wordpress, gutenberg, data, redux

readme

Gutenberg

End-to-End Tests Static Analysis (Linting, License, Type checks...) Unit Tests Create Block React Native E2E Tests (iOS) React Native E2E Tests (Android)

Storybook Badge

lerna

Screenshot of the Gutenberg Editor, editing a post in WordPress

Welcome to the development hub for the WordPress Gutenberg project!

"Gutenberg" is a codename for a whole new paradigm in WordPress site building and publishing, that aims to revolutionize the entire publishing experience as much as Gutenberg did the printed word. Right now, the project is in the second phase of a four-phase process that will touch every piece of WordPress -- Editing, Customization, Collaboration (which includes Real-time collaboration, Asynchronous collaboration, Publishing flows, Post revisions interface, Admin design, Library), and Multilingual -- and is focused on a new editing experience, the block editor.

The block editor introduces a modular approach to pages and posts: each piece of content in the editor, from a paragraph to an image gallery to a headline, is its own block. And just like physical blocks, WordPress blocks can be added, arranged, and rearranged, allowing WordPress users to create media-rich pages in a visually intuitive way -- and without work-arounds like shortcodes or custom HTML.

The block editor first became available in December 2018, and we're still hard at work refining the experience, creating more and better blocks, and laying the groundwork for the next three phases of work. The Gutenberg plugin gives you the latest version of the block editor, so you can join us in testing bleeding-edge features, start playing with blocks, and maybe get inspired to build your own.

Check out the Keeping up with Gutenberg Index

Getting Started

Get hands on: check out the block editor live demo to play with a test instance of the editor.

Using Gutenberg

Developing for Gutenberg

Extending and customizing is at the heart of the WordPress platform, this is no different for the Gutenberg project. The editor and future products can be extended by third-party developers using plugins.

Review the Quick Start Guide for the fastest way to get started extending the block editor. See the Block Editor Handbook for extensive tutorials, documentation, and API references. Also, check the WordPress Developer Blog for great articles about block development, among other topics.

Contribute to Gutenberg

Gutenberg is an open-source project and welcomes all contributors from code to design, and from documentation to triage. The project is built by many contributors and volunteers, and we'd love your help building it.

See the Contributors Handbook for all the details on how you can contribute.

To get up and running quickly with code contribution see Getting Started With Code Contribution. Also check out the other resources available on the Code Contributions page.

In whichever way you wish to contribute please be sure to read the Contributing Guidelines first.

As with all WordPress projects, we want to ensure a welcoming environment for everyone. With that in mind, all contributors are expected to follow our Code of Conduct.

Get Involved

You can join us in the #core-editor channel in Slack, see the WordPress Slack page for signup information; it is free to join.

License

WordPress is free software, and is released under the terms of the GNU General Public License version 2 or (at your option) any later version. See LICENSE.md for complete license.



Code is Poetry.

changelog

Unreleased

10.22.0 (2025-04-11)

10.21.0 (2025-03-27)

10.20.0 (2025-03-13)

10.19.0 (2025-02-28)

10.18.0 (2025-02-12)

10.17.0 (2025-01-29)

10.16.0 (2025-01-15)

10.15.0 (2025-01-02)

10.14.0 (2024-12-11)

10.13.0 (2024-11-27)

Enhancements

  • Upgrade redux dependency to ^5.0.1 (#66966)

10.12.0 (2024-11-16)

10.11.0 (2024-10-30)

10.10.0 (2024-10-16)

10.9.0 (2024-10-03)

10.8.0 (2024-09-19)

10.7.0 (2024-09-05)

10.6.0 (2024-08-21)

10.5.0 (2024-08-07)

10.4.0 (2024-07-24)

10.3.0 (2024-07-10)

10.2.0 (2024-06-26)

10.1.0 (2024-06-15)

10.0.0 (2024-05-31)

Breaking Changes

  • Increase the minimum required Node.js version to v18.12.0 matching long-term support releases (#31270). Learn more about Node.js releases.

9.28.0 (2024-05-16)

9.27.0 (2024-05-02)

9.26.0 (2024-04-19)

  • Add new createSelector function for creating memoized store selectors (#60370).

9.25.0 (2024-04-03)

9.24.0 (2024-03-21)

  • Deprecate the getIsResolved meta-selector (#59679).

9.23.0 (2024-03-06)

9.22.0 (2024-02-21)

9.21.0 (2024-02-09)

9.20.0 (2024-01-24)

9.19.0 (2024-01-10)

9.18.0 (2023-12-13)

9.17.0 (2023-11-29)

9.16.0 (2023-11-16)

9.15.0 (2023-11-02)

9.14.0 (2023-10-18)

9.13.1 (2023-10-12)

Bug Fixes

  • Fix combineReducers() types (#55321).

9.13.0 (2023-10-05)

Enhancements

  • Change implementation of combineReducers so that it doesn't use eval internally, and can run with a CSP policy that doesn't allow unsafe-eval (#54606).

9.12.0 (2023-09-20)

9.11.0 (2023-08-31)

9.10.0 (2023-08-16)

Enhancements

  • Warn if the useSelect hook returns different values when called with the same state and parameters (#53666).

9.9.0 (2023-08-10)

Bug Fixes

  • Update the type definitions for dispatched actions by accounting for Promisified return values and thunks. Previously, a dispatched action's return type was the same as the return type of the original action creator, which did not account for how dispatch works internally. (Plain actions get wrapped in a Promise, and thunk actions ultimately resolve to the innermost function's return type).
  • Update the type definition for dispatch() to handle string store descriptors correctly.

9.8.0 (2023-07-20)

9.7.0 (2023-07-05)

9.6.0 (2023-06-23)

9.5.0 (2023-06-07)

9.4.0 (2023-05-24)

9.3.0 (2023-05-10)

9.2.0 (2023-04-26)

9.1.0 (2023-04-12)

9.0.0 (2023-03-29)

Breaking Changes

  • The registry.register function will no longer register a store if another instance is registered with the same name.

8.6.0 (2023-03-15)

8.5.0 (2023-03-01)

8.4.0 (2023-02-15)

8.3.0 (2023-02-01)

8.2.0 (2023-01-11)

8.1.0 (2023-01-02)

8.0.0 (2022-12-14)

Breaking Changes

  • Updated dependencies to require React 18 (45235)

Enhancements

  • The registry.subscribe function can now subscribe to updates only from one specific store, with a new optional parameter.

7.6.0 (2022-11-16)

7.5.0 (2022-11-02)

7.4.0 (2022-10-19)

7.3.0 (2022-10-05)

7.2.0 (2022-09-21)

7.1.0 (2022-09-13)

7.0.0 (2022-08-24)

Breaking Changes

– Add TypeScript types to the built package (via "types": "build-types" in the package.json)

Bug Fixes

  • Packages: Replace is-plain-obj with is-plain-object (#43511).

6.15.0 (2022-08-10)

6.14.0 (2022-07-27)

6.13.0 (2022-07-13)

Enhancements

  • Use useDebugValue in useSelect to better display data in React DevTools (#42225).

6.12.0 (2022-06-29)

6.11.0 (2022-06-15)

6.10.0 (2022-06-01)

6.9.0 (2022-05-18)

6.8.0 (2022-05-04)

6.7.0 (2022-04-21)

6.6.0 (2022-04-08)

6.5.0 (2022-03-23)

6.4.0 (2022-03-11)

6.3.0 (2022-02-23)

New Features

  • Enabled thunks by default for all stores and removed the __experimentalUseThunks flag.
  • Store the resolution errors in store metadata and expose them using hasResolutionFailed the getResolutionError meta-selectors (#38669).
  • Expose the resolution status (undefined, resolving, finished, error) via the getResolutionState meta-selector (#38669).

6.2.1 (2022-02-10)

Bug Fixes

  • Removed unused memize dependency (#38388).

6.2.0 (2022-01-27)

Bug Fixes

  • Corrected expect type of action creators and selectors in Redux store configuration type
  • Move redux to regular dependencies and update it to version ^4.1.2.

Internal

  • Changed names of store-related types to better reflect their use and role.
  • Changed "storeDefinition" to "storeDescriptor" to better reflect its use and role.

6.1.0 (2021-09-09)

New Features

  • Added a batch registry method to batch dispatch calls for performance reasons.
  • Add a new migration for the persistence plugin to migrate edit-widgets preferences to the interface package. As part of this change deprecated migrations for the persistence plugin have been removed (#33774).
  • Update data controls to accept a data store definition as their first param in addition to a string-based store name value (#34170).

6.0.0 (2021-07-29)

Breaking Changes

  • Upgraded React components to work with v17.0 (#29118). There are no new features in React v17.0 as explained in the blog post.

5.2.0 (2021-07-21)

5.1.0 (2021-05-20)

5.0.0 (2021-05-14)

Breaking Changes

New Features

  • Added new startResolutions and finishResolutions actions as batched variants of startResolution and finishResolutions actions.

Enhancements

4.27.0 (2021-03-17)

New Features

  • Added new resolveSelect registry method to initiate and wait for selector resolution

4.26.0 (2020-12-17)

New Features

  • Added new register function for registering a standard @wordpress/data store definition (#26655).
  • Added new createReduxStore factory function that creates a data store definition for the provided Redux store options to use with register function (#26655).
  • Extended select and dispatch functions to accept a data store definition as their first param in addition to a string-based store name value #26655).
  • Extended useDispatch hook to accept a data store definition as their first param in addition to a string-based store name value #26655).

Deprecations

  • registerGenericStore has been deprecated. Use register instead.
  • registerStore has been deprecated. Use register instead.

4.6.0 (2019-06-12)

New Features

  • Expose useSelect hook for usage in functional components. (#15737)
  • Expose useDispatch hook for usage in functional components. (#15896)

Enhancements

  • withSelect internally uses the new useSelect hook. (#15737. Note: This could impact performance of code using withSelect in edge-cases. To avoid impact, memoize passed in mapSelectToProps callbacks or implement useSelect directly with dependencies.
  • withDispatch internally uses a new useDispatchWithMap hook (an internal only api) (#15896)

4.5.0 (2019-05-21)

Bug Fixes

  • Restore functionality of action-generators returning a Promise. Clarify intent and behaviour for dispatch behaviour. Dispatch actions now always return a promise (#14830

Enhancements

  • Expose hasResolver property on returned selectors indicating whether the selector has a corresponding resolver.

4.3.0 (2019-03-06)

Enhancements

  • The registerStore function now accepts an optional initialState option value.
  • Introduce new invalidateResolutionForStore dispatch action for signalling to invalidate the resolution cache for an entire given store.
  • Introduce new invalidateResolutionForStoreSelector dispatch action for signalling to invalidate the resolution cache for a store selector (and all variations of arguments on that selector).

Bug Fixes

  • Resolves issue in the persistence plugin where passing persist as an array of reducer keys would wrongly replace state values for the unpersisted reducer keys.
  • Restores a behavior in the persistence plugin where a default state provided as an object will be deeply merged as a base for the persisted value. This allows for a developer to include additional new keys in a persisted value default in future iterations of their store.

4.2.0 (2019-01-03)

Enhancements

  • Optimized performance of selector execution (~511% improvement)

4.1.0 (2018-12-12)

New Features

  • withDispatch's mapDispatchToProps function takes the registry object as the 3rd param (#11851).
  • withSelect's mapSelectToProps function takes the registry object as the 3rd param (#11851).

4.0.1 (2018-11-20)

4.0.0 (2018-11-15)

Breaking Changes

  • registry.registerReducer has been removed. Use registry.registerStore instead.
  • registry.registerSelectors has been removed. Use registry.registerStore instead.
  • registry.registerActions has been removed. Use registry.registerStore instead.
  • registry.registerResolvers has been removed. Use registry.registerStore instead.

Bug Fixes

  • Resolve an issue where withSelect's mapSelectToProps would not be rerun if the wrapped component had incurred a store change during its mount lifecycle.

3.1.2 (2018-11-09)

3.1.1 (2018-11-09)

3.1.0 (2018-11-03)

New Features

  • registry.registerGenericStore has been added to support integration with existing data systems.

Deprecations

  • registry.registerReducer has been deprecated. Use registry.registerStore instead.
  • registry.registerSelectors has been deprecated. Use registry.registerStore instead.
  • registry.registerActions has been deprecated. Use registry.registerStore instead.
  • registry.registerResolvers has been deprecated. Use registry.registerStore instead.

3.0.1 (2018-10-30)

Internal

  • Replace Redux implementation of combineReducers with in-place-compatible turbo-combine-reducers.

3.0.0 (2018-10-29)

Breaking Changes

  • Writing resolvers as async generators has been removed. Use the controls plugin instead.

2.1.4 (2018-10-19)

2.1.3 (2018-10-18)

2.1.0 (2018-09-30)

New Features

  • Adding support for using controls in resolvers using the controls plugin.

Internal

  • Updated redux dependency to the latest version.

Deprecations

  • Writing resolvers as async generators has been deprecated. Use the controls plugin instead.

Bug Fixes

  • Fix the promise middleware in Firefox.

2.0.0 (2018-09-05)

Breaking Changes

  • The withRehdyration function is removed. Use the persistence plugin instead.
  • The loadAndPersist function is removed. Use the persistence plugin instead.
  • restrictPersistence, setPersistenceStorage and setupPersistence functions have been removed. Please use the data persistence plugin instead.
  • Change how required built-ins are polyfilled with Babel 7 (#9171). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using core-js or @babel/polyfill will add support for these methods.