skip to Main Content

How to add itemscope itemtype="http://schema.org/WebPage" to html tag using function.php

add_filter( 'nav_menu_link_attributes', 'add_menu_attributes', 10, 3 );

function jrod_add_html_manifest( $output ) {

    $output .= ' itemscope itemtype="http://schema.org/WebPage"';

    return $output;
}

2

Answers


  1. Chosen as BEST ANSWER

    How to add same http://schema.org/WebPage into the <html lang="en-US"> in between <html > using function.php


  2. your filter its not loading the function you have provided.

    Here is working solution

    function add_itemscope_itemtype_filter( $atts, $item, $args ) {
        $atts['itemscope itemtype'] = 'http://schema.org/WebPage';
        return $atts;
    }
    add_filter('nav_menu_link_attributes', 'add_itemscope_itemtype_filter', 3, 10);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search