Skip to content

Commit

Permalink
fix: Fix problem when an empty ACF taxonomy relationship field transf…
Browse files Browse the repository at this point in the history
…orm loads all terms instead of none. (#2960)
  • Loading branch information
rubas committed May 14, 2024
1 parent 54ed1e5 commit f95b82a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Integration/AcfIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ public static function transform_relationship($value, $id, $field)
*/
public static function transform_taxonomy($value, $id, $field)
{
if (empty($value)) {
return false;
}
if ($field['field_type'] === 'select' || $field['field_type'] === 'radio') {
return Timber::get_term((int) $value);
}
Expand All @@ -215,6 +218,9 @@ public static function transform_taxonomy($value, $id, $field)
*/
public static function transform_user($value, $id, $field)
{
if (empty($value)) {
return false;
}
if (!$field['multiple']) {
return Timber::get_user((int) $value);
}
Expand Down

0 comments on commit f95b82a

Please sign in to comment.