• Resolved g

    (@gmd8)


    Hi There- I’m creating a WordPress theme and am trying to figure out if the author of a post’s bio is blank so that I won’t have a big blank area in my theme- it the author does have a filled in bio, I’d like to display it. On my single post files, I have this test code, but it is always reading that the author does not have a description. What am I doing wrong? Thanks.

    <?php
    
    if ( empty($curauth->description) ) {
    	echo 'This author does not have a description.';
    } else {
    	echo 'This author does have a description.';
    }
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Do you have this before that if test?

    $curauth = get_userdata($post->post_author); //get data for current post author

    Thread Starter g

    (@gmd8)

    I used something very similar to that with $curauth but not that- after replacing the code with that, it works! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Checking If Author Bio Is Blank’ is closed to new replies.