I have managed to do the following. I made a clear cache button:
function advanza_direct_plugin_delete_transients() {
delete_transient( 'advanza_direct_terms_of_service' );
delete_transient( 'advanza_direct_privacy_policy' );
// at the end redirect to target page
exit( wp_redirect( admin_url( 'admin.php?page=advanza-direct-plugin-settings' ) ) );
}
add_action( 'admin_post_advanza_direct_plugin_delete_transients', 'advanza_direct_plugin_delete_transients' );
I put this where I have my admin logic:
<form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
<input type="hidden" name="action" value="advanza_direct_plugin_delete_transients">
<?php submit_button( 'Clear cache', 'delete', '', false ); ?>
</form>