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 16:26] timothy [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. | ||
- | In WooCommerce the description will be stored in the ''wp_posts'' table inside ''post_content'' field. 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. | + | 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; | You can modify that hook like this; | ||
+ | <code PHP> | ||
add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 ); | add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 ); | ||
Line 121: | Line 122: | ||
return $data; | 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. | + | 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. |