Replaces whole top-level keys, leaving the rest of the configuration alone.
Description
Like merge() and replace(), set() applies a patch of top-level keys and touches only the keys the patch names: a key the patch omits keeps whatever it had, and a null value drops the key it names (which resets it to its default). The difference is depth — where merge() and replace() merge a named key's value into the current one key by key, set() swaps the whole value in wholesale, dropping whatever the key held before. A null nested within that value still drops the property it names, so set() honours nulls at every depth just as merge() and replace() do. Use it when a callback owns a key outright and wants to pin it to an exact shape, without the inherited default leaking through a key-by-key merge. A patch that declares an unsupported schema version is rejected and does not change anything.
Parameters
$patcharray
The partial configuration whose named keys to replace.
$versionint
The schema version the patch was authored against.
Signature, return type and hooks compared across 1 parsed release.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/class-wp-view-config-data.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.