From 23b7472366323a5815be3b261291e6fe9ce28a16 Mon Sep 17 00:00:00 2001 From: saifsultanc Date: Wed, 17 Sep 2025 13:45:28 +0530 Subject: [PATCH] `gpnf-hide-empty-columns.php`: Fixed an issue withsnippet not working for fields having data stored on sub field IDs like Name, Address, etc. --- gp-nested-forms/gpnf-hide-empty-columns.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gp-nested-forms/gpnf-hide-empty-columns.php b/gp-nested-forms/gpnf-hide-empty-columns.php index 1efe9417f..a1dd85a65 100644 --- a/gp-nested-forms/gpnf-hide-empty-columns.php +++ b/gp-nested-forms/gpnf-hide-empty-columns.php @@ -163,8 +163,13 @@ function gpnfHecColumnHasValue( fieldId, entries ) { function gpnf_hec_column_has_value( $field_id, $entries ) { foreach ( $entries as $entry ) { - if ( rgar( $entry, $field_id ) ) { - return true; + foreach ( $entry as $key => $value ) { + // Match $field_id or subfield IDs (For fields like Name, Address, etc).) + if ( preg_match( '/^' . preg_quote( $field_id, '/' ) . '(\.\d+)?$/', $key ) ) { + if ( ! rgblank( $value ) ) { + return true; + } + } } } return false;