0
<div class="kkk" style="background-image:url('<?php echo get_avatar_url(); ?>')"></div>

I want to make to appear my avatar as a backround image in this code, but it doesn't work. What is the problem?

1

It’s hard to say exactly what the problem is with your code, but...

There is at least one major flaw - you don’t pass any param to get_avatar_url, but first param for that function is required and should contain ID or email. To be precise:

$id_or_email (mixed) (Required) The Gravatar to retrieve a URL for. Accepts a user_id, gravatar md5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.

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.