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

I've recently added a new field into the User Profile section of my blog So that I may define the gender of the user.

On the author bio section I have this code:

$authorgender = strtolower(get_the_author_meta('gender'));

if ($authorgender = "male") {
    $genderoutput = "his";
} else {
    $genderoutput = "her";

And the place i'm using it is:

  <p><a href="<?php the_author_meta('url'); ?>" target="_blank" title="<?php the_author(); ?>'s website (new window)">Check out <?php echo $genderoutput; ?> website</a>

I have two users, One myself which I changed the gender to 'Male' and one a random woman called sally-louise-fredericke-swann and her gender was set to 'Female'.

However, the $genderoutput generates 'his' for both users. Not happy :/

Any Ideas?

share|improve this question
if ($authorgender = "male") {

Needs to be

if ($authorgender == "male") {

== is a comparison operator http://www.php.net/manual/en/language.operators.comparison.php

= assigns the value to the variable http://www.php.net/manual/en/language.variables.basics.php

share|improve this answer
Holy crap, im so tired and thank you very much! more caffeine needed me thinks - never a good idea to try and code after a 10 hour shift in a restaurant. – Mark Petherbridge Jan 20 '12 at 18:29

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.