Чтобы убрать из шапки код нужно немного поправить код файла class-frontend.php в папке плагина. После обновления плагина требуется повторить действия заново.
Строку:
add_action( 'wpseo_head', array( $this, 'debug_marker' ), 2 );
Заменяем на следующую. То есть комментируем ее.
// add_action( 'wpseo_head', array( $this, 'debug_marker' ), 2 );
Из строк:
Удаляется лишнее, чтобы получилось так:
Строку:
$content = str_replace( $this->debug_marker( false ), $this->debug_marker( false ) . "\n" . '<title>' . $title . '</title>', $content );
Меняем на такую:
$content = str_replace( $this->debug_marker( false ), '<title>' . $title . "</title>\n", $content );
Строку просто удаляем.
echo "<!-- / Yoast WordPress SEO plugin. -->\n\n";
functions.php используемой темы добавить
Строку:
Заменяем на следующую. То есть комментируем ее.
Из строк:
PHP:
function debug_marker( $echo = true ) {
$marker = "<!-- This site is optimized with the Yoast WordPress SEO plugin v" . WPSEO_VERSION . " - http: / / yoast.com/wordpress/seo/ -->";
if ( !$echo )
return $marker;
else
echo "\n${marker}\n";
}
PHP:
function debug_marker( $echo = true ) {
$marker = "";
if ( !$echo )
return $marker;
else
echo "";
}
Меняем на такую:
Строку просто удаляем.
functions.php используемой темы добавить
PHP:
if (defined(‘WPSEO_VERSION’)){
add_action(‘get_header’,function (){ ob_start(function ($o){
return preg_replace(‘/\n?/mi’,»,$o); }); });
add_action(‘wp_head’,function (){ ob_end_flush(); }, 999);
}