Show menu links for anonymous users only I need to show the user register link as a menu item in the account menu. I am able to add the link in the menu via links.menu.yml.

The menu links shows up for anonymous users as well as authenticated users but not for admin user role.

How can I hide the menu item for logged in users irrespective of user role?
Tried all the options to hide the menu item from authenticated users irrespective of the role, but admin always sees it. Did that using CSS and Menu Link Attributed module. Using the module I added a class to the menu link and then using the body class user-logged-in hid the menu item for logged in user.

I am still open to any other alternative and a better solution.