woocommerce_structured_data_context

woocommerce_structured_data_context

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_structured_data_context') is found 2 times:

  • /includes/class-wc-structured-data.php line 103
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    // Wrap the multiple values of each type inside a graph... Then add context to each type.
    foreach ( $data as $type => $value ) {
        $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.
    $data = $types ? array_values( array_intersect_key( $data, array_flip( $types ) ) ) : array_values( $data );
     
    if ( ! empty( $data ) ) {
  • /includes/class-wc-structured-data.php line 111
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    $data = $types ? array_values( array_intersect_key( $data, array_flip( $types ) ) ) : array_values( $data );
     
    if ( ! empty( $data ) ) {
        if ( 1 < count( $data ) ) {
            $data = apply_filters( 'woocommerce_structured_data_context', array( '@context' => 'https://schema.org/' ), $data, '', '' ) + array( '@graph' => $data );
        } else {
            $data = $data[0];
        }
    }
     
    return $data;