简体   繁体   中英

PHP filter for WooCommerce product description

I am working on a webstore and need to filter my discription text. My data gives me unicodes that need to be filtert out.

I have the filter part wrking but need to filter the product description.

A filter I found realy close is add_filter('woocommerce_product_description_heading', 'filter_unicode') . But this is for the header of the description. I also tried woocommerce_product_description_content but this was without any sucsess.

Does anyone know what filter i need to use?

I worked it out (finnaly),

I gave up on that spesiffic string.

I did it by using ob_start("filter_unicode") ;

This will filter the whole content!

My code:

add_action('after_setup_theme', 'start_filter_page');
add_action('shutdown', 'end_filter_page');

function start_filter_page() { 
 ob_start("filter_unicode"); 
} 

function end_filter_page() {
 if(ob_get_length() > 0) {
    ob_clean();
 }
}

The ob_start("filter_unicode"); will start the function filter_unicode() where i manipulate the string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM