Title: Enqueue CSS and scripts only when required
Last modified: September 3, 2023

---

# Enqueue CSS and scripts only when required

 *  [rd78](https://wordpress.org/support/users/rd78/)
 * (@rd78)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/enqueue-css-and-scripts-only-when-required/)
 * Hello,
 * Thanks for making such a great weather plugin.
 * I noticed that the CSS and javascript files are enqueued across my whole site
   and not just the pages where the weather shortcode is used. For performance reasons,
   I’d prefer the scripts to be enqueued only where necessary.
 * Is it possible to add the enqueue_script/enqueue_style to the shortcode, rather
   than loading it globally across the whole site?
 * Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Uwe Jacobs](https://wordpress.org/support/users/uwejacobs/)
 * (@uwejacobs)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/enqueue-css-and-scripts-only-when-required/#post-17114591)
 * I’ll look into that for one of the upcoming releases.
    -  This reply was modified 2 years, 8 months ago by [Uwe Jacobs](https://wordpress.org/support/users/uwejacobs/).
 *  Thread Starter [rd78](https://wordpress.org/support/users/rd78/)
 * (@rd78)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/enqueue-css-and-scripts-only-when-required/#post-17114928)
 * Fantastic, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Enqueue CSS and scripts only when required’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/owm-weather_3a88fe.svg)
 * [OWM Weather](https://wordpress.org/plugins/owm-weather/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/owm-weather/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/owm-weather/)
 * [Active Topics](https://wordpress.org/support/plugin/owm-weather/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/owm-weather/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/owm-weather/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [rd78](https://wordpress.org/support/users/rd78/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/enqueue-css-and-scripts-only-when-required/#post-17114928)
 * Status: not resolved