Change the expiration time for the wc_product_loop_ transient from 30 days to 1 day in WooCommerce

Change the expiration time for the wc_product_loop_ transient from 30 days to 1 day in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_action( 'setted_transient', 'mmx_wc_product_loop_transient', 50, 3 );
function mmx_wc_product_loop_transient( $transient, $value, $expiration ){
	$pos = strpos( $transient, 'wc_product_loop_' );
	if ( $pos !== false && $expiration == 2592000 ) {
		set_transient( $transient, $value, DAY_IN_SECONDS );
	}
}
1 Like