diff --git a/changelog.md b/changelog.md index 742ebfba..57dc40a1 100644 --- a/changelog.md +++ b/changelog.md @@ -50,6 +50,10 @@ - **Accommodation price display** - Added price information to single accommodation template with improved layout for better presentation - **Rating stars styling** - Added new styles for rating stars display with improved spacing and alignment in accommodation info section +#### Itinerary + +- **Itinerary connected field term list** - Fixed term list retrieval in `lsx_to_itinerary_connected_field()` by normalising the data array with `array_values()` before extracting the first element, ensuring `get_the_term_list()` always receives a valid post ID rather than a potentially non-zero-indexed array offset + #### Query Loops & Filtering - **Query Block Class Detection** - Improved reliability of query block class detection by checking `innerHTML` instead of `attrs['className']`, ensuring custom classes like `on-sale`, `parents-only`, and `custom-order` are properly detected even when applied via block variations or programmatically diff --git a/includes/functions.php b/includes/functions.php index fcf1a708..e59866fb 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -315,7 +315,11 @@ function lsx_to_itinerary_connected_field( $field, $type, $before = '', $after = $data = (array) $data; if ( $term_list ) { - $return = get_the_term_list( $data[0], $type, $before, ', ', $after ); + $first_term = array_values( $data ); + if ( is_array( $first_term ) && ! empty( $first_term ) ) { + $first_term = $first_term[0]; + } + $return = get_the_term_list( $first_term, $type, $before, ', ', $after ); } else { $return = $before . lsx_to_connected_list( $data, $type, true, ', ' ) . $after; }