Title: Scripts are not enqueued
Last modified: August 30, 2016

---

# Scripts are not enqueued

 *  Resolved [B M](https://wordpress.org/support/users/mampf/)
 * (@mampf)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/scripts-are-not-enqueued/)
 * You should not output `<script type="javascript">` using echo.
 * See this example:
    [https://plugins.trac.wordpress.org/browser/per-post-scripts-and-styles/trunk/PPSS_Controller.php](https://plugins.trac.wordpress.org/browser/per-post-scripts-and-styles/trunk/PPSS_Controller.php)
 * Create a cached file for each article (by id) and use a loader for each article,
   and then `wp_enqueue_script()`. You only need to detect changes, which should
   be no problem (on article save/modify).
 * This way plugins like autoptimize, cachify, better wordpress minify (bwp) and
   other can compress your output.
 * See:
    [http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/](http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/)
   [https://developer.wordpress.org/reference/functions/wp_enqueue_script/](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)
 * [https://wordpress.org/plugins/json-ld-for-article/](https://wordpress.org/plugins/json-ld-for-article/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [B M](https://wordpress.org/support/users/mampf/)
 * (@mampf)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/scripts-are-not-enqueued/#post-6886888)
 * Cannot be done, because it needs to be inline.
 * See: [https://core.trac.wordpress.org/ticket/35264#comment:2](https://core.trac.wordpress.org/ticket/35264#comment:2)

Viewing 1 replies (of 1 total)

The topic ‘Scripts are not enqueued’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-ld-for-article_c2c2c2.svg)
 * [JSON-LD for Article](https://wordpress.org/plugins/json-ld-for-article/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-ld-for-article/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-ld-for-article/)
 * [Active Topics](https://wordpress.org/support/plugin/json-ld-for-article/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-ld-for-article/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-ld-for-article/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [enqueue](https://wordpress.org/support/topic-tag/enqueue/)

 * 1 reply
 * 1 participant
 * Last reply from: [B M](https://wordpress.org/support/users/mampf/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/scripts-are-not-enqueued/#post-6886888)
 * Status: resolved