$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>description - How strip the quotation from the meta descrption?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

description - How strip the quotation from the meta descrption?

matteradmin9PV0评论

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.

Post a comment

comment list (0)

  1. No comments so far