• Resolved sdfbcxvxdsf

    (@sdfbcxvxdsf)


    Hi,

    trying to insert a very simple code snippet into my page, just grabbing the title of the page and echoing it. However once Google Search indexed the page it adds whitespace and line breaks before and after the title. Is there anyway to prevent this? i’ve tried with the below code.

    <?php
    $title = get_the_title();
    $title = str_replace(array("\n", "\r\n", "\r", "\t", "    "), "", $title);
    echo esc_html($title);
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘White Space and Linebreak’ is closed to new replies.