-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Versioned theme_mods values are still being written to the database. They're messy and useless. These shouldn't actually be written, but it might be a good idea to try and clean up orphans when writing the new values. The return on line 329 doesn't seem to be preventing the value from being written under the longer name?
wp-theme-init/src/ThemeInit.php
Lines 302 to 332 in f7a951d
| public function readOption($val, $opt) | |
| { | |
| $optBase = preg_replace($this->semverRegex, '', $opt); | |
| // if $optBase and $opt match, getting the option will nest infinitely | |
| return $optBase === $opt ? $val : get_option($optBase); | |
| } | |
| public function writeOption($val, $oldVal, $opt) | |
| { | |
| $optBase = preg_replace($this->semverRegex, '', $opt); | |
| /** | |
| * Because this filter is triggered _from inside_ update_option(), | |
| * calling update_option() again with the same inputs would cause | |
| * WordPress to nest infinitely and crash the server. | |
| * | |
| * We must check that $optBase and $opt are different before we can | |
| * update the value attached to the corrected option name. | |
| */ | |
| if ($optBase !== $opt) { | |
| update_option($optBase, $val); | |
| /** | |
| * Returning $oldVal short-circuits the original update_option() | |
| * call. Since we've already updated the value under the modified | |
| * name, there's no need to write an extra wp_options entry which | |
| * will never be used. | |
| */ | |
| return $oldVal; | |
| } | |
| return $val; | |
| } |
Metadata
Metadata
Assignees
Labels
No labels
