diff --git a/src/Directives/WordPress.php b/src/Directives/WordPress.php index 7d0a1de..b350412 100644 --- a/src/Directives/WordPress.php +++ b/src/Directives/WordPress.php @@ -431,8 +431,15 @@ 'role' => function ($expression) { $expression = Util::parse($expression); + $condition = []; - return "get(0)}), (array) wp_get_current_user()->roles)) : ?>"; // phpcs:ignore + foreach ($expression as $value) { + $condition[] = "&& in_array(strtolower({$value}), (array) wp_get_current_user()->roles)"; + } + + $conditions = implode(' ', $condition); + + return ""; // phpcs:ignore }, 'endrole' => function () {