Created
July 7, 2024 14:52
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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