Product structured data tweak
This commit is contained in:
parent
cea9b59523
commit
5a005d9ee9
|
@ -329,6 +329,12 @@ class WC_Structured_Data {
|
||||||
$markup['itemListElement'] = array();
|
$markup['itemListElement'] = array();
|
||||||
|
|
||||||
foreach ( $crumbs as $key => $crumb ) {
|
foreach ( $crumbs as $key => $crumb ) {
|
||||||
|
// Don't add the current page to the breadcrumb list on product pages,
|
||||||
|
// otherwise Google will not recognize both the BreadcrumbList and Product structured data.
|
||||||
|
if ( is_product() && count( $crumbs ) - 1 === $key ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$markup['itemListElement'][ $key ] = array(
|
$markup['itemListElement'][ $key ] = array(
|
||||||
'@type' => 'ListItem',
|
'@type' => 'ListItem',
|
||||||
'position' => $key + 1,
|
'position' => $key + 1,
|
||||||
|
|
Loading…
Reference in New Issue