Skip title, description and exceprt sanitization and let WP handle it

Should simulate the same behavior from WP admin, so just need to skip
extra sanitization, so WP can handle it while salving with
`wp_insert_post()` and `wp_update_post()` where will check for
`unfiltered_html` capability.

WP core already did something like it, but on REST API: https://core.trac.wordpress.org/ticket/38609

Fixes #16195
This commit is contained in:
Claudio Sanches 2017-08-10 17:17:56 -03:00
parent 1745447c7c
commit fe05e09015
1 changed files with 16 additions and 3 deletions

View File

@ -442,6 +442,19 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
return '';
}
/**
* Just skip current field.
*
* By default is applied wc_clean() to all not listed fields
* in self::get_formating_callback(), use this method to skip any formating.
*
* @param string $value Field value.
* @return string
*/
public function parse_skip_field( $value ) {
return $value;
}
/**
* Get formatting callback.
*
@ -460,9 +473,9 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
'featured' => array( $this, 'parse_bool_field' ),
'date_on_sale_from' => array( $this, 'parse_date_field' ),
'date_on_sale_to' => array( $this, 'parse_date_field' ),
'name' => 'wp_filter_post_kses',
'short_description' => 'wp_filter_post_kses',
'description' => 'wp_filter_post_kses',
'name' => array( $this, 'parse_skip_field' ),
'short_description' => array( $this, 'parse_skip_field' ),
'description' => array( $this, 'parse_skip_field' ),
'manage_stock' => array( $this, 'parse_bool_field' ),
'backorders' => array( $this, 'parse_backorders_field' ),
'stock_status' => array( $this, 'parse_bool_field' ),