if user role is then echo text

I’m working on a custom theme. For my comment section, if the user role is administrator I want to display “Admin”, if subscriber “Subscriber”, etc.

The problem is, I will add this code and “Admin” shows beside all users even if not admin (I’ve tried changing the role, this is just an admin example):

if(current_user_can(‘administrator’)) { echo ”; }

Here is another one I tried, did not work at all:

echo ‘Admin’;
echo ‘Subscriber’;

Read more here:: if user role is then echo text

Leave a Reply

Your email address will not be published. Required fields are marked *