Merge pull request #16313 from opportus/master

Fixes #16010
This commit is contained in:
Mike Jolley 2017-08-03 08:24:12 +02:00 committed by GitHub
commit 52b10d8be4
1 changed files with 2 additions and 5 deletions

View File

@ -91,11 +91,8 @@ class WC_Structured_Data {
// Wrap the multiple values of each type inside a graph... Then add context to each type.
foreach ( $data as $type => $value ) {
if ( 1 < count( $value ) ) {
$data[ $type ] = apply_filters( 'woocommerce_structured_data_context', array( '@context' => 'https://schema.org/' ), $data, $type, $value ) + array( '@graph' => $value );
} else {
$data[ $type ] = $value[0];
}
$data[ $type ] = count( $value ) > 1 ? array( '@graph' => $value ) : $value[0];
$data[ $type ] = apply_filters( 'woocommerce_structured_data_context', array( '@context' => 'https://schema.org/' ), $data, $type, $value ) + $data[ $type ];
}
// If requested types, pick them up... Finally change the associative array to an indexed one.