php 删除WordPress中的[All in One SEO Pack]或[Yoast SEO] HTML评论(适用于functions.php)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 删除WordPress中的[All in One SEO Pack]或[Yoast SEO] HTML评论(适用于functions.php)相关的知识,希望对你有一定的参考价值。
<?php
/**
* Remove [All in One SEO Pack] HTML Comments
* @link //gist.github.com/llgruff/a7ab776167aa0ed307ec445df54e5fdb
*/
if (defined('AIOSEOP_VERSION')) {
add_action('get_header', function() {
ob_start(
function($o) {
return preg_replace('/\n?<.*?One SEO Pack.*?>/mi','',$o);
}
);
});
add_action('wp_head', function() {
ob_end_flush();
}, 999);
}
/**
* Remove [Yoast SEO] HTML Comments
* @link //gist.github.com/llgruff/a7ab776167aa0ed307ec445df54e5fdb
* @link //gist.github.com/paulcollett/4c81c4f6eb85334ba076
*/
if (defined('WPSEO_VERSION')) {
add_action('get_header', function() {
ob_start(
function($o) {
return preg_replace('/\n?<.*?yoast.*?>/mi','',$o);
}
);
});
add_action('wp_head', function() {
ob_end_flush();
}, 999);
}
以上是关于php 删除WordPress中的[All in One SEO Pack]或[Yoast SEO] HTML评论(适用于functions.php)的主要内容,如果未能解决你的问题,请参考以下文章
删除邮政`` Wrap in Wordpress
php 删除WordPress中的默认图像链接
php 删除WordPress中的默认图像链接
从 iis7 中的 wordpress URL 中删除 index.php
使用虚拟主机时删除 Wordpress 子文件夹中的 index.php
PHP 从Wordpress中的标题标签中删除“查看...下的所有帖子”