Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created December 2, 2019 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewlimaza/880db4118d5b40c63dd5cb3b6e617db1 to your computer and use it in GitHub Desktop.
Save andrewlimaza/880db4118d5b40c63dd5cb3b6e617db1 to your computer and use it in GitHub Desktop.
Reset visits, views and logins for Paid Memberships Pro.
<?php
/**
* Add &pmpro_reset_analytics=1 to your WordPress dashboard URL/Paid Memberships Pro reports page.
* 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() {
if ( isset( $_REQUEST["pmpro_reset_analytics"] ) ) {
delete_option( 'pmpro_visits' );
delete_option( 'pmpro_views' );
delete_option( 'pmpro_logins' );
delete_option( '_transient_timeout_pmpro_report_memberships_signups' );
delete_option( '_transient_timeout_pmpro_report_memberships_signups' );
delete_option( '_transient_pmpro_report_memberships_signups' );
}
}
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