将模式添加到元<head> -tag:wordpress

I am trying to put this (below code) to my wordpress header but when i save and load site on browser it does not show up. I have seen this schema practice on some wordpress themes so it should work. Does anyone have advice? Is it some automatic wordpress function that changes this.

<head itemscope="" itemtype="http://schema.org/WebSite">

do it like this on your header.php

<html <?php html_tag_schema(); ?> <?php language_attributes(); ?>>

and you need to write the function html_tag_schema() now. write the below function on your active theme's functions.php

function html_tag_schema()
{
$schema = 'http://schema.org/';

// Is single post
if(is_single())
{
    $type = "Article";
}
// Contact form page ID
else if( is_page(1) )
{
    $type = 'ContactPage';
}
// Is author page
elseif( is_author() )
{
    $type = 'ProfilePage';
}
// Is search results page
elseif( is_search() )
{
    $type = 'SearchResultsPage';
}
// Is of movie post type
elseif(is_singular('movies'))
{
    $type = 'Movie';
}
// Is of book post type
elseif(is_singular('books'))
{
    $type = 'Book';
}
else
{
    $type = 'WebPage';
}

echo 'itemscope="itemscope" itemtype="' . $schema . $type . '"';
}

I hope this one solves your problem