woocommerce / woocommerce-rest-api

This is the WooCommerce core REST API Package. It runs standalone as a feature plugin too.
71 stars 46 forks source link

Updating a category removes HTML from the description #287

Open redelschaap opened 11 months ago

redelschaap commented 11 months ago

We experience two issues regarding HTML in the product category description.

  1. When creating or updating a product category using the REST API, most HTML is removed from the category description. However, the description supports more HTML when creating or editing a product category in the WordPress Admin, so I would say that the description field in the REST API should also support the same HTML options.

  2. HTML is also removed from the category description when the description field is not included in the update request. In that case, I would expect that the description field remains unchanged.

Steps to reproduce:

  1. Given the current state of the description: image
  2. After updating the category (with or without the description field present): image
  3. The description is stripped from most HTML: image
yulumadavid commented 3 months ago

We also experience this behaviour. Nevertheless when you switch Yoast SEO off you are not able to add any tags like <h1> in it. So it seems the Woo rEST API just follows the IDE way.

There is a fix:

/**

foreach ( array( 'term_description' ) as $filter ) { remove_filter( $filter, 'wp_kses_data' ); }