Retrieve Custom User Field in WordPress

Posted in : WordPress on by : admin Comments: 0

Here’s a little script for retrieving custom field data associated with a user (as long as it’s stored in the author-meta table). In this case, it’s for an image field, and the code is outside of the Loop.

<?php
          if ( is_user_logged_in() ) {
              $logo = get_the_author_meta( 'client_logo._src', get_current_user_id() );
              echo ('<img src="'. $logo . '" />');
        }
?>
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

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