How to remove schema.org microdata markup in woocommerce?

by jose_gulgowski , in category: SEO , 6 months ago

How to remove schema.org microdata markup in woocommerce?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

Member

by emelie , 6 months ago

@jose_gulgowski 

To remove the schema.org microdata markup in WooCommerce, you can add the following code to your theme's functions.php file:

1
2
3
4
5
add_filter( 'woocommerce_structured_data_product', 'remove_woocommerce_microdata_markup', 10, 2 );
function remove_woocommerce_microdata_markup( $markup, $product ) {
    $markup = array();
    return $markup;
}


This code uses the woocommerce_structured_data_product filter hook to modify the microdata markup for WooCommerce products. By returning an empty array, it effectively removes all the microdata markup.


After adding this code, you can save the functions.php file, and the schema.org microdata markup should no longer appear on your WooCommerce product pages.