Skip to content

Commit 717c00f

Browse files
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
1 parent ed03527 commit 717c00f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/wp-includes/user.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4990,11 +4990,11 @@ function wp_register_persisted_preferences_meta() {
49904990
'type' => 'object',
49914991
'single' => true,
49924992
'show_in_rest' => array(
4993-
'name' => 'persisted_preferences',
4994-
'type' => 'object',
4995-
'context' => array( 'edit' ),
4996-
'schema' => array(
4993+
'name' => 'persisted_preferences',
4994+
'type' => 'object',
4995+
'schema' => array(
49974996
'type' => 'object',
4997+
'context' => array( 'edit' ),
49984998
'properties' => array(
49994999
'_modified' => array(
50005000
'description' => __( 'The date and time the preferences were updated.' ),

tests/phpunit/tests/user/wpRegisterPersistedPreferencesMeta.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public function test_should_register_persisted_preferences_meta() {
3636
'sanitize_callback' => null,
3737
'auth_callback' => '__return_true',
3838
'show_in_rest' => array(
39-
'name' => 'persisted_preferences',
40-
'type' => 'object',
41-
'context' => array( 'edit' ),
42-
'schema' => array(
39+
'name' => 'persisted_preferences',
40+
'type' => 'object',
41+
'schema' => array(
4342
'type' => 'object',
43+
'context' => array( 'edit' ),
4444
'properties' => array(
4545
'_modified' => array(
4646
'description' => __( 'The date and time the preferences were updated.' ),

0 commit comments

Comments
 (0)