|
/ Documentation /Troubleshooting/ Load LatePoint Front-End Scripts Only on Specific Pages

Load LatePoint Front-End Scripts Only on Specific Pages

By default, LatePoint loads its front-end CSS and JavaScript on all pages of your website to ensure booking forms and buttons work correctly.

If you only use LatePoint on specific pages, you can use the latepoint_should_load_front_scripts filter to load these assets only where they are needed, helping reduce unnecessary asset loading on other pages.

Example

Add the following code using a custom functionality plugin or the Code Snippets plugin:

add_filter( 'latepoint_should_load_front_scripts', function( $should_load ) {
// Only load LatePoint front-end assets on the booking page.
if ( is_page( array( 'booking-form' ) ) ) {
return true;
}
return false;
}, 10, 1 );

Replace booking-form with the slug of your booking page.

If you have multiple booking pages, add them to the array:

if ( is_page( array( 'booking-form', 'book-now', 'appointments' ) ) ) {
return true;
}

Please make sure that every page containing a LatePoint booking form, booking button, or other LatePoint front-end functionality is included. If LatePoint assets are not loaded on a page that contains a booking form or booking button, those features will not function correctly.

If you’re unsure which pages require LatePoint assets, we recommend leaving the default behavior unchanged.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.