J. Doe J. Doe - 4 months ago 8
PHP Question

PHP lcfirst not working?

I want to lowercase the first letter of my title.

<title><?php echo lcfirst(bloginfo('name')); ?>.blog</title>




  • This should result into: super.blog

  • But results into: Super.blog




I have tried:

<title><?php
$bloginfo = bloginfo('name');
echo lcfirst($bloginfo);
?>.blog</title>


How is this possible? Am I doing it wrong?

Answer

In wordpress, the function bloginfo echos the result. Use get_bloginfo instead.

See code below for the bloginfo function.

function bloginfo( $show = '' ) {
    echo get_bloginfo( $show, 'display' );
}

See: https://developer.wordpress.org/reference/functions/bloginfo/

https://developer.wordpress.org/reference/functions/get_bloginfo/

Comments