I try to add custom class on get avatar in comment walker

get_avatar( $comment, $args['avatar_size'], '', '', array('class' => 'myclass') );

But class doesn’t show in source code. Thx

Edit : Output

<img src="...default.png" width="48" height="48" alt="Avatar" class="avatar avatar-48wp-user-avatar wp-user-avatar-48 alignnone photo avatar-default">
  • what gets output? – mozboz Jul 16 at 9:32
  • The default avatar img – David Sticker Jul 16 at 9:34
  • sorry, i wasn't clear - please can you add the HTML that gets output to the question – mozboz Jul 16 at 9:35
  • Are you sure it's this line that is used to render the avatar? Are you echoing it, as this function just returns a value, and the class parameter looks correct – mozboz Jul 16 at 9:37
  • Added output result – David Sticker Jul 16 at 9:46

Your Answer

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

Browse other questions tagged or ask your own question.