S
S
Sjhhducsj2021-05-04 22:11:31
WooCommerce
Sjhhducsj, 2021-05-04 22:11:31

How to remove variable wrapping tag in woocommerce?

There is a piece of code:

<?php foreach ( $product_attributes as $product_attribute_key => $product_attribute ) : ?>
      <span class="wp-attributes wp-attributes--<?php echo esc_attr( $product_attribute_key ); ?>">
      <span class="attribute-label"><?php echo wp_kses_post( $product_attribute['label'] ); ?></span>
      <span class="attribute-value"><?php echo wp_kses_post( $product_attribute['value'] ); ?></span>
    </span>
  <?php endforeach; ?>

Which outputs to the page:
<span class="wp-attributes wp-attributes--attribute_pa_1">
      <span class="attribute-label">Ключ</span>
      <span class="attribute-value"><p><a href="https://site.ru" rel="tag">Значение</a></p></span>
    </span>

I'm confused by the paragraph tag, which breaks the line. How to find where this paragraph is set? I understand that it is written somewhere for this piece of $product_attribute['value'] code, but I don't understand how to find it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sjhhducsj, 2021-05-05
@Sjhhducsj

solved like this: Perhaps there is a better way?
strip_tags( $product_attribute['value'], '<a>');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question