$value ) { // skip null values if ( $value === null ) { continue; } // skip empty marketing_permissions property if ( $key === 'marketing_permissions' && empty( $value ) ) { continue; } // otherwise, add to final array $array[ $key ] = $value; } return $array; } }