Pass template values inside head tag

I want to add schema values in JSON-LD inside tag. Cant find in documentation as search bar is no more available.

Hey there,
It seems like they temporarily removed it (the search bar) because there is a bug but they will put it back asap.
However, for your schema problem, I can show you how I added mine using microdata (I’m more familiar with this one)

<li itemprop="itemListElement" itemscope
      itemtype="https://schema.org/ListItem" style="list-style: none;" class="tt-breadcrumb-item text-xs">
    <span itemscope itemtype="https://schema.org/WebPage"
       itemprop="item" itemid="{Taxonomy=category}">
      <span itemprop="name"><Loop field=archive_term><Field title /></Loop></span></span>
    <meta itemprop="position" content="2" />
  </li>

And you can simply add this in any template and put it wherever you want it to be displayed. The schema will be grabbed by SEO.

1 Like

Thanks for response and I am already using similar schema in my other website but this time I need to add it in head.

Hi Zakir,

The feature closest to what you’re describing is the Meta tag, which puts things in the document <head>.

But it’s limited to only known/defined meta fields, it doesn’t support schema yet. And it needs to run early in the page lifecycle, before wp_head action which generates everything in <head>.

The Layout template type could possibly work - but they’re currently designed to take over the whole page, so it will need an additional option (maybe location type “Head”) for this purpose.

It sounds like a useful feature, I’ve made a note of it and will come back to this comment thread to let you know when there’s progress.

1 Like