<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?
<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?
Share Improve this question edited Feb 5, 2019 at 17:04 Krzysiek Dróżdż 25.6k9 gold badges53 silver badges74 bronze badges asked Feb 5, 2019 at 16:01 AskingAsking 1211 silver badge6 bronze badges1 Answer
Reset to default 1It’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.