Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shameemreza/2e2e97cff9802bb248d5fe49b4469337 to your computer and use it in GitHub Desktop.
Save shameemreza/2e2e97cff9802bb248d5fe49b4469337 to your computer and use it in GitHub Desktop.
Change the expiration time for the wc_product_loop_ transient from 30 days to 1 day in WooCommerce
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 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment