This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:integrations:woocommerce [2020/12/21 14:55] joebordes [Frequently Asked Questions] |
en:integrations:woocommerce [2020/12/21 16:40] (current) timothy [Frequently Asked Questions] |
||
---|---|---|---|
Line 111: | Line 111: | ||
??? How can we send HTML descriptions to WooCommerce and back. | ??? How can we send HTML descriptions to WooCommerce and back. | ||
- | !!! TBD | + | In WooCommerce the description will be stored in the **wp_posts** table inside **post_content** column. In general WordPress uses some filters to encode and decode the value of **post_content** before saving and displaying it. You need to use Wordpress **wp_insert_post_data** hook to modify the passed value of **post_content** before saving it to the database. |
+ | |||
+ | You can modify that hook like this; | ||
+ | <code PHP> | ||
+ | add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 ); | ||
+ | |||
+ | function filter_post_data( $data , $postarr ) { | ||
+ | // Change post content | ||
+ | $data['post_content'] = html_entity_decode($data['post_content']); | ||
+ | return $data; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | The goal is to save the raw data with html tags on the database. That script can be added to your child theme’s **functions.php** file or via a plugin that allows custom functions to be added. |