WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Can someone tell, how to check whether it's empty?

<?php bloginfo('description'); ?>

Something like:

<?php if (!empty bloginfo('description');) ?>

Thanks a lot.

share|improve this question
up vote 2 down vote accepted
if ( get_bloginfo( 'description' ) ) {
    //do something

bloginfo echoes the description, get_bloginfo returns php variable

share|improve this answer
Thanks, but it doesn't work to me. – raymond Dec 1 '11 at 16:46
This works: <?php if(get_bloginfo('description') <> '') { ?> // do something <?php } ?> – raymond Dec 1 '11 at 16:51

Ptriek's example checks if the value is true and unfortunately an empty value still evaluates to true, hence why it doesn't work as expected. Try the following instead..

<?php if( !empty( get_bloginfo('description') ) : ?>

<!-- your html -->

<?php endif; ?>

NOTE: An empty check will also ring true for empty strings, so covers exactly the same case as the code you posted in the comment on ptriek's answer..

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.