Line brake in Checkout

#741063
  • Resolved Ehv
    Rank Math pro
    Content AI Starter

    Hi,

    for any reason rank math is adding line brakes <br> to my website.
    There was a br tag added to my woocommerce checkout page – why? And how?

    Please view the attached images.

    Screenshot

    Thanks!
    Niko

Viewing 5 replies - 16 through 20 (of 20 total)
  • Ehv
    Rank Math pro
    Content AI Starter

    Hi Nicholas,

    sorry for that, the server address was not correct. I have updated it. Please try again.

    Thank you!
    Niko

    Hello,

    Thank you for providing FTP access. The get_the_excerpt function appears to be the cause of the issue. When a description isn’t added to a page, the function defaults to get_the_excerpt(), which seems to be where the problem arises. It appears that the Astra theme is utilizing the get_the_excerpt filter, which adds those line breaks.

    As previously mentioned by my colleague, this issue isn’t exclusive to the Rank Math plugin; it’s likely to occur with other SEO plugins as well. I recommend reaching out to the Astra team so they can take a look at this.

    For now, to fix the issue on your site, I’ve added a dummy description to the Checkout page using the following filter code in the Code Snippet “Rank Math SEO – Remove Button from Admin Bar”.

    
    add_filter( 'rank_math/frontend/description', function( $description ) {
    	if ( is_checkout() ) {
    		return 'Complete your purchase securely and easily with our streamlined checkout process';
    	}
    
    	return $description;
    });
    

    Hope that helps.

    Ehv
    Rank Math pro
    Content AI Starter

    Hi, the problem seem to be fixed.
    What was the problem here? What was the reason?

    Cheers!
    Niko

    Ehv
    Rank Math pro
    Content AI Starter

    Thanks a lot!

    Hello,

    Just as my colleague stated above the issue was from the Astra theme utilizing the get_the_excerpt filter, which adds those line breaks when a description is not added to a page. The get_the_excerpt function appears to be the cause of the issue.

    The code shared by my colleague adds a dummy description to the Checkout page.

    We are glad the code resolved the issue. If you have further concerns and questions don’t hesitate to let us know.

    Thanks.

Viewing 5 replies - 16 through 20 (of 20 total)

You must be logged in to reply to this ticket.