Users: Correctly pass the context property for persisted preferences.

The user meta `context` property in `wp_register_persisted_preferences_meta()` was incorrectly configured. It should be part of the `schema` array, not the `show_in_rest` array.

Follow-up to [54182].

Props talldanwp, dd32.
Fixes #56665. See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54329 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-09-27 15:21:48 +00:00
parent ed035279d2
commit 717c00fcfe
2 changed files with 8 additions and 8 deletions

View File

@ -4990,11 +4990,11 @@ function wp_register_persisted_preferences_meta() {
'type' => 'object',
'single' => true,
'show_in_rest' => array(
'name' => 'persisted_preferences',
'type' => 'object',
'context' => array( 'edit' ),
'schema' => array(
'name' => 'persisted_preferences',
'type' => 'object',
'schema' => array(
'type' => 'object',
'context' => array( 'edit' ),
'properties' => array(
'_modified' => array(
'description' => __( 'The date and time the preferences were updated.' ),

View File

@ -36,11 +36,11 @@ class Tests_User_WpRegisterPersistedPreferencesMeta extends WP_UnitTestCase {
'sanitize_callback' => null,
'auth_callback' => '__return_true',
'show_in_rest' => array(
'name' => 'persisted_preferences',
'type' => 'object',
'context' => array( 'edit' ),
'schema' => array(
'name' => 'persisted_preferences',
'type' => 'object',
'schema' => array(
'type' => 'object',
'context' => array( 'edit' ),
'properties' => array(
'_modified' => array(
'description' => __( 'The date and time the preferences were updated.' ),