Skip to content

Commit

Permalink
Merge pull request #3 from kingandpartners/feature/ignore-field-keys-…
Browse files Browse the repository at this point in the history
…specified-in-array-when-converting-false-to-null

Feature/ignore field keys specified in array when converting false to null
  • Loading branch information
jGRUBBS authored Sep 10, 2020
2 parents 6adf9f6 + baac322 commit ac3e82f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/utils/class-arrayhelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ public static function convert_false_to_null( array $array ) {
array_walk_recursive(
$array,
function( &$value, $key ) {
if ( false === $value ) {

$ignore_keys = array(
'enable'
);

if ( !in_array( $key, $ignore_keys ) && false === $value ) {
$value = null;
}

Expand Down

0 comments on commit ac3e82f

Please sign in to comment.