This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Limiting date filter year

#55198
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Well, that can’t be adjusted on the back-end, but it can be programmatically via a custom code snippet:

add_action('wp_footer', 'wp_footer_datepicker_range_fix', 9999);
function wp_footer_datepicker_range_fix() {
	?>
	<script>
	(function($){
		setTimeout(function(){
			$('.asp_w .hasDatepicker').datepicker('option', 'yearRange', '-9:+1')
		}, 500);
	})(jQuery);
	</script>
	<?php
}

This snippet above will adjust the year range from -9 to +1 years, meaning 2016 to 2026. You can change that on the 6th line as you need it.