From b11c4998173e3e5a952bc984a02522ddfb9c4868 Mon Sep 17 00:00:00 2001 From: Mike Hemberger Date: Fri, 10 Jun 2022 10:42:02 -0400 Subject: [PATCH] Fixes but with defaults and using the same option Fixes my part of https://github.com/kirki-framework/kirki/issues/2466 A TL;DR quick test to see the bug is to create 2 fields that save to the same option. Make sure a default is set when registering both. Then only update one of the fields. The updated field works but the default does not work for the field that doesn't have a value in the DB yet. --- packages/kirki-framework/data-option/src/Option.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kirki-framework/data-option/src/Option.php b/packages/kirki-framework/data-option/src/Option.php index 96290f0f0..f509e77c3 100644 --- a/packages/kirki-framework/data-option/src/Option.php +++ b/packages/kirki-framework/data-option/src/Option.php @@ -89,7 +89,7 @@ public function kirki_get_value( $value = '', $option = '', $default = '', $type * We need to change the value accordingly depending on whether * this is the last item in the loop or not. */ - $value = ( isset( $parts[ $key + 1 ] ) ) ? [] : ''; + $value = ( isset( $parts[ $key + 1 ] ) ) ? [] : $default; } }