$messages) { if (!is_array($messages) || !isset($b['locale_data'][$key]) || !is_array($b['locale_data'][$key])) { continue; } // Keys of $a stay, keys only in $b are added; the header entry ("") stays the one of $a. $a['locale_data'][$key] = $messages + $b['locale_data'][$key]; } return (string) wp_json_encode($a); } }