Disabling dates in datepicker

Sorry if i appear a bit slow.

Admin page saves dates to database.

some php code runs when order page loads gets dates from database using
wp_localize_script to make them available to the .js file

.js file is edited to use the data from wp_localize_script

Yes exactly. wp_localize_script just makes PHP data available as a JS variable. You can see an example of how to use it here: wp_localize_script() | Function | WordPress Developer Resources

1 Like

Ok
I will use this as my outline plan and report back once it is working, or, more likely, when I have further questions or run into problems :slight_smile:

2 Likes

wp_localize_script is very easy to use. Maybe the name is misleading, but in the same way you can pass a variable with translated strings you can pass an array of dates to exclude.

I am a great fan of mu-plugins and use them all the time, though I do like to put the following line right at the top:

<?php if( ! defined( 'ABSPATH' ) ) { die(); }
2 Likes