feat(wpmc S4): Helpers::main_town_slug reads ACF option

This commit is contained in:
Vladimir Bryzgalov
2026-05-16 19:21:31 +05:00
parent 0565357b5e
commit f4184a7777
2 changed files with 32 additions and 0 deletions
+12
View File
@@ -99,4 +99,16 @@ final class Helpers
$fragment = isset($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
return $path . $query . $fragment;
}
public static function main_town_slug(): ?string
{
if (!\function_exists('get_field')) {
return null;
}
$value = \get_field('main_town_slug', 'option');
if ($value instanceof \WP_Term) {
return $value->slug !== '' ? $value->slug : null;
}
return is_string($value) && $value !== '' ? $value : null;
}
}