Browse: Home / Snippets /

Force page reload on Restart Quiz button click

Contents


Snippet #

Important: All snippets are provided as-is without support or guarantees. These snippets are provided as guidelines for advanced users looking to customize LearnDash. For any additional help or support with these snippets, we recommend reaching out to a LearnDash Expert.

/**
 * LearnDash - Force page reload when RestartQuiz button is clicked. 
 */
add_action( 'wp_footer', function(){
	?>
	<script>
	jQuery(document).ready(function() {
		if ( jQuery('.wpProQuiz_content input[name="restartQuiz"]' ).length ) {
			jQuery( '.wpProQuiz_content input[name="restartQuiz"]' ).click(function( event ) {
				window.location.reload(true);
			});
		}
	});
	</script>
	<?php
}, 999 );