Forked from kimwhite/reset-pmpro-visits-views-logins.php
Created
January 10, 2023 21:34
-
-
Save michaelbeil/36922681002ca69c464daaa32729b08c to your computer and use it in GitHub Desktop.
Reset visits, views logins and sales and Revenue for Paid Memberships Pro.
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
<?php | |
/** | |
* Add http://yoursite.com/wp-admin/admin.php?&pmpro_reset_analytics=1 to your url while logged in. | |
* Add this code to your Code Snippets / Custom Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* You may remove this code from your site when you don't need it any longer. | |
*/ | |
function my_pmpro_reset_visit_data() { | |
// Check if URL parameter pmpro_reset_analytics is set | |
if ( isset( $_REQUEST['pmpro_reset_analytics'] ) ) { | |
// Clear visits, views and logins | |
delete_option( 'pmpro_visits' ); | |
delete_option( 'pmpro_views' ); | |
delete_option( 'pmpro_logins' ); | |
// clear reports | |
delete_option( '_transient_timeout_pmpro_report_prices_paid' ); | |
delete_option( '_transient_pmpro_report_prices_paid ' ); | |
delete_option( '_transient_timeout_pmpro_report_sales' ); | |
delete_option( '_transient_pmpro_report_sales' ); | |
delete_option( '_transient_timeout_pmpro_report_revenue' ); | |
delete_option( '_transient_pmpro_report_revenue' ); | |
delete_option( '_transient_timeout_pmpro_report_memberships_signups' ); | |
delete_option( '_transient_pmpro_report_memberships_signups' ); | |
delete_option( '_transient_timeout_pmpro_report_memberships_cancellations' ); | |
delete_option( '_transient_pmpro_report_memberships_cancellations' ); | |
} | |
} | |
add_action( 'init', 'my_pmpro_reset_visit_data' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment