Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Limiting date filter year › Reply To: Limiting date filter year
August 27, 2025 at 6:45 pm
#55341
Keymaster
It’s definitely possible to resolve, I think I just made a mistake in the code, please try this one instead:
add_action(
'wp_footer',
function () {
?>
<script>
window.addEventListener("load", () => {
const loadYears = ()=> {
setTimeout(function(){
jQuery('.asp_w .hasDatepicker').datepicker('option', 'yearRange', '-9:+1')
}, 500);
};
document.querySelectorAll(".asp_main_container").forEach((el) => {
el.addEventListener("asp_settings_show", (event) => {
loadYears();
});
});
loadYears();
});
</script>
<?php
}
);
I used a jQuery shorthand $ in the previous code which didn’t work. This should be the one.