0

I'm trying to output the slug of the comment author. I'm able to output the username using get_comment_author() but I can'tfigure out how to output the slug.

For example, username might be Test User while the slug might be test-user1

Howw can I output the comment author slug?

0

If you have the username then you should be able to get the user using the get_user_by function, which will return the user object

https://developer.wordpress.org/reference/functions/get_user_by/

$user = get_user_by(field, value);
| improve this answer | |
  • This doesn't help if you don't have the username. I need to output it directly. – user6686780 Mar 5 '17 at 23:51
  • Sorry I thought you said you had the username 'I'm able to output the username using get_comment_author()' – Jonathan Bossenger Apr 12 '17 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.