WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have a custom field on the author page, where a user uploads a image which will be used as a background image on their author page. I've setup up everything except I'm not sure how to setup a conditional to display a default image when the user hasn't upload his/her own image.

The custom $curauth-> field is called user_banner.

So basically:

[if user_banner]

The image would be displayed here.


The default image would go here.


Any ideas?

share|improve this question

A combination of get_queried_object_id to fetch the current user ID and get_user_meta to retrieve the banner should do the trick.

// somewhere in your theme's author.php

if ($img = get_user_meta(get_queried_object_id(), 'user_banner', true)) {
   // they uploaded an image, use it
} else {
   // they did not upload the image, show the default
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.