description - How strip the quotation from the meta descrption?

admin2025-06-07  48

I checked the HTML validator. But, the message is the following.

Quote " in attribute name. Probable cause: Matching quote missing somewhere earlier.

The meta description is automatic from the content. So, if the content includes the quotation, it is also included in meta descrption. I would like to strip the quotation.

Currently, I inserted the code in header.php as below.

$description = strip_shortcodes($description); 
$description = wp_strip_all_tags($description);

What should I add?

I checked the HTML validator. But, the message is the following.

Quote " in attribute name. Probable cause: Matching quote missing somewhere earlier.

The meta description is automatic from the content. So, if the content includes the quotation, it is also included in meta descrption. I would like to strip the quotation.

Currently, I inserted the code in header.php as below.

$description = strip_shortcodes($description); 
$description = wp_strip_all_tags($description);

What should I add?

Share Improve this question asked Oct 19, 2018 at 5:18 YoosYoos 13 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

Try to use Yoast SEO: https://it.wordpress/plugins/wordpress-seo/

It's the best plugin for SEO in WP and should be strips all "dangerous" chars

Probably, it works for HTML5 Validator.

$description = str_replace(array("\r\n","\r","\n"," ",'"',"'"),'',$description);

$description = strip_shortcodes($description);

$description = wp_strip_all_tags($description);

First quotation is removed, but second one is not removed, though.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749249026a317603.html

最新回复(0)