Add upgrading event on plugins loaded

This commit is contained in:
dinamiko 2021-11-08 11:07:37 +01:00
parent f746c41a83
commit 2c8d0fcf8a
2 changed files with 26 additions and 4 deletions

View file

@ -54,10 +54,22 @@ class VaultingModule implements ModuleInterface {
'init',
function () {
add_rewrite_endpoint( 'ppcp-paypal-payment-tokens', EP_PAGES );
if ( ! get_option( 'woocommerce-ppcp-payment-tokens-flushed', false ) ) {
flush_rewrite_rules();
add_option( 'woocommerce-ppcp-payment-tokens-flushed', true );
}
}
);
add_action(
'woocommerce_paypal_payments_gateway_migrate',
function () {
add_rewrite_endpoint( 'ppcp-paypal-payment-tokens', EP_PAGES );
flush_rewrite_rules();
}
);
add_action(
'woocommerce_paypal_payments_gateway_activate',
function () {
add_rewrite_endpoint( 'ppcp-paypal-payment-tokens', EP_PAGES );
flush_rewrite_rules();
}
);