Title: Plugins do not automatically load js/css
Last modified: February 10, 2019

---

# Plugins do not automatically load js/css

 *  Resolved [fantasts](https://wordpress.org/support/users/fantasts/)
 * (@fantasts)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/plugins-do-not-automatically-load-js-css/)
 * First of all, this is a great plugin, I like it very much and can’t leave it.
   Some recent problems have prevented me from using them properly.
 * Recently I used cached output for the content of the article, and the plugin 
   no longer works.
 * The plugin segment code can output the code normally, but the CSS/JS file cannot
   be loaded automatically.
 * If I click on the preview change in the article editing page, the article in 
   preview mode can load the file normally.
 * This made me very confused, I tried to read the code of the plugin loading file
   part, but still can’t understand why.
 * Below is the code for my cached article.
 *     ```
       $group = 'single';
           if(is_user_logged_in()){
               $key = 'login'.get_the_ID();
           } else {
               $key = 'tourist'.get_the_ID();
           }
           if(is_preview()){
               $html = false;
           } else {
               $html = zww_cache_html($key, $group);
           }
           if(! $html){
               ob_start();
       ......Article content......
        $html = ob_get_clean();
           $html .= "<!-- From single_post cache in ". date("Y-m-d H:i:s",time())." -->";
           zww_cache_html($key, $group, $html, 86400);
           }
           echo $html;
       ```
   

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

 *  Plugin Author [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/plugins-do-not-automatically-load-js-css/#post-11189213)
 * Hi [@fantasts](https://wordpress.org/support/users/fantasts/),
 * shortcodes scripts and stylesheets are included dynamically ([example](https://github.com/vanokhin/shortcodes-ultimate/blob/master/includes/shortcodes/box.php#L87)).
   If you cache page content, no assets will be included.
 * You shouldn’t cache only page content. Try to cache the whole page instead.
 *  Plugin Author [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/plugins-do-not-automatically-load-js-css/#post-11189217)
 * Alternatively, you can force the loading of assets site-wide:
 * [https://docs.getshortcodes.com/article/83-shortcodes-and-ajax-content](https://docs.getshortcodes.com/article/83-shortcodes-and-ajax-content)

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

The topic ‘Plugins do not automatically load js/css’ is closed to new replies.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [WP Shortcodes Plugin — Shortcodes Ultimate](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Vova](https://wordpress.org/support/users/gn_themes/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/plugins-do-not-automatically-load-js-css/#post-11189217)
 * Status: resolved