Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi testitit!

    There’s no built-in way to reset the click counts, but you still have a couple of options:

    1. Trash the link you want to reset, empty the trash, and add a link using the same name and URL as the original. This effectively resets the link count.

    Alternatively, to reset all link counts at once to zero, you can follow these steps:

    2a. Take a full site backup. (You can use a plugin such as https://www.ads-software.com/plugins/backupwordpress/ or a service such as https://vaultpress.com/. )

    2b. Add the following code to your active theme’s functions.php file:

    add_action( 'admin_init', 'simple_urls_reset_link_count' );
    
    function simple_urls_reset_link_count() {
    	$simple_urls = get_posts( array( 'post_type' => 'surl', 'posts_per_page' => - 1 ) );
    	foreach ( $simple_urls as $url ) {
    		update_post_meta( $url->ID, '_surl_count', 0 );
    	}
    }

    2c. Visit any admin page.

    2d. Verify that the counts have reset on the Simple URLs admin page.

    2e. Remove the above code from your functions file.

    Thread Starter testitit

    (@testitit)

    Thanks Nick, I think I’ll go with your first suggestion.

    It seems like quite an easy feature to add but I might be wrong ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Resetting stats’ is closed to new replies.