diff --git a/src/Attributes/Meta.php b/src/Attributes/Meta.php index 08d0026..251259b 100644 --- a/src/Attributes/Meta.php +++ b/src/Attributes/Meta.php @@ -16,11 +16,7 @@ public function __construct(private ?string $metaKey = null) public function getValue(string|int $objectID, string $metaKey, string $prefix): mixed { if (isset($this->metaKey)) { - if ($value = \get_field($this->metaKey, $objectID)) { - return $value; - } else { - return null; - } + return \get_field($this->metaKey, $objectID); } $possibleKeys = [ @@ -31,7 +27,8 @@ public function getValue(string|int $objectID, string $metaKey, string $prefix): ]; foreach ($possibleKeys as $key) { - if ($value = \get_field($key, $objectID)) { + $value = \get_field($key, $objectID); + if (null !== $value) { return $value; } }