You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove special handling of raw / rendered attributes from core-data #34449
You have to be extra careful about the source of your record. If it comes from getEntityRecord, it may or may not have the nested .raw data. If it comes from getRawEntityRecord, it won't have it for sure.
maybe an ideal scenario WP API is just an adapter for core-data to the WordPress API, and core-data's object structures have actual meaningful formats defined by the package itself (and potentially be inspired by WP's format).
Questions to discuss:
What kind of format we want to expose to core-data's consumers?
How do we edit core-data's entities? editEntity({ title: { raw: "something" } }) or just. editEntity({ title: 'something' }) ?
What happens to the "rendered" property when the "raw" changes in the edited entity? should it return an error, match raw (we can't since it's generated server side), something else...
Once we have a PR in place, we should also check for performance regressions (there may be a performance impact caused by switching from shallow object spread to deep object merge).
changed the title [-]Move post-specific logic out of core-data package[/-][+]Remove special handling of `raw` / `rendered` attributes from core-data[/+]on Sep 1, 2021
Tested on trunk: getEntityRecord keeps { raw, rendered }, while getEditedEntityRecord returns the raw string for the fields listed in the entity's rawAttributes. Entities without rawAttributes, like root/site, are not flattened.
Two of the problems listed here were fixed: #34388 added rawAttributes so only the listed post fields are flattened (not other entities), and #34502 removed the raw extraction from saveEntityRecord.
The flattening itself is on purpose. The code says edits are raw values, so records are returned the same way to make comparing and joining them with edits easy. Removing it would change what getEditedEntityRecord returns and what editEntityRecord takes, which every plugin that edits a title or content relies on. Closing as not planned.
Activity
[-]Move post-specific logic out of core-data package[/-][+]Remove special handling of `raw` / `rendered` attributes from core-data[/+]ellatrix commentedon Nov 4, 2026
Tested on trunk:
getEntityRecordkeeps{ raw, rendered }, whilegetEditedEntityRecordreturns the raw string for the fields listed in the entity'srawAttributes. Entities withoutrawAttributes, likeroot/site, are not flattened.Two of the problems listed here were fixed: #34388 added
rawAttributesso only the listed post fields are flattened (not other entities), and #34502 removed the raw extraction fromsaveEntityRecord.The flattening itself is on purpose. The code says edits are raw values, so records are returned the same way to make comparing and joining them with edits easy. Removing it would change what
getEditedEntityRecordreturns and whateditEntityRecordtakes, which every plugin that edits a title or content relies on. Closing as not planned.Partly automated with help from Claude.