【发布时间】:2023-12-24 06:10:01
【问题描述】:
在我的 wordpress 网站上,文章的引用如下所示: « xxxx » 东西 bla bla bla
如何将那些 « » 引号转换为看起来更像 ' 或 ",从而在元 og / google 描述中使用更少的空间? 但在某种程度上,它不会破坏标题/描述等的代码?
有什么想法吗? 谢谢!
【问题讨论】:
在我的 wordpress 网站上,文章的引用如下所示: « xxxx » 东西 bla bla bla
如何将那些 « » 引号转换为看起来更像 ' 或 ",从而在元 og / google 描述中使用更少的空间? 但在某种程度上,它不会破坏标题/描述等的代码?
有什么想法吗? 谢谢!
【问题讨论】:
我假设你所有的
https://www.thewebtaylor.com/articles/wordpress-replace-string-in-content-of-all-pages
function replace_content($content)
{
$content = str_replace('<<', '"',$content);
$content = str_replace('>>', '"',$content);
$content = str_replace('<<', '"',$content);
$content = str_replace('>>', '"',$content);
return $content;
}
add_filter('the_content','replace_content');
【讨论】: