-
Strip all whitespace from the left end of the title:
<?php echo ltrim(wp_title('')); ?>
-
Strip all whitespace from either end:
<?php echo trim(wp_title('')); ?>
-
Strip all spaces from the left end of the title:
<?php echo ltrim(wp_title(''), ' '); ?>
-
Remove the first space, even if it’s not the first character:
<?php echo str_replace(' ', '', wp_title(''), 1); ?>
-
Strip only a single space (not newline, not tab) at the beginning:
<?php echo preg_replace('/^ /', '', wp_title('')); ?>
-
Strip the first character, whatever it is:
<?php echo substr(wp_title(''), 1); ?>
Update
From the WordPress documentation on wp_title
, it appears that wp_title
displays the title itself unless you pass false
for the second parameter, in which case it returns it. So try:
<?php echo trim(wp_title('', false)); ?>