How to Get Profile image in WordPress

How-to-Get-Profile-image-in-wordpress

This code for getting your profile image in WordPress, this code is working, try this code.

<?php
 $user_id=get_the_author_id(get_the_ID());
 $meta=get_user_meta($user_id);
 $user=get_userdata($user_id);
 #print_r($user);
 $image_attributes = wp_get_attachment_image_src( $attachment_id = $meta['et_avatar'][0] );
 if ( $image_attributes ) {?>
  <img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>" />
 <?php }else{?>
  <img src="http://ture.bollywoodbite.in/wp-content/uploads/2016/08/default_avatar.png">
  <?php

} ?>
Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.

Leave a Reply

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

Contact us

Fill in the form below or give us a call and we'll contact you. We endeavour to answer all enquiries within 24 hours on business days.