Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REST API, Meta: Store updates in database when they are equal to the …
…defaults. This patch fixes an oversight from when default metadata values were introduced in #43941 in WordPress 5.5: metadata updates should persist in the database even if they match the registered default value (because the default values can change over time). Previously, the REST API code was comparing updated values against the value returned by the default-aware `get_metadata()` method. This meant that if no value existed in the database, and the default value was supplied to the update, WordPress would think that the updated value was already persisted and skip the database call. Now, the `get_metadata_raw()` method is called for comparing whether or not a database update is required, fixing the bug. In this patch both issues are resolved. Developed in WordPress#6782 Discussed in https://core.trac.wordpress.org/ticket/55600 Follow-up to [48402]. Props: dmsnell, kraftner, ramon-fincken. Fixes #55600. git-svn-id: https://develop.svn.wordpress.org/trunk@58831 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information