Title: PHP Notice: wp_enqueue_script was called incorrectly
Last modified: April 10, 2019

---

# PHP Notice: wp_enqueue_script was called incorrectly

 *  Resolved [stevemullen](https://wordpress.org/support/users/stevemullen/)
 * (@stevemullen)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-was-called-incorrectly-3/)
 * This plugin appears to call wp_enqueue_script directly in a handful of its extensions.
   This is not supported and generates PHP warnings. These are the instances I found.
   I believe there are more:
 * `w3-total-cache/Extension_Swarmify_Widget.php`
    ln 18 – wp_enqueue_style is called
   directly.
 * `w3-total-cache/Cdnfsd_LimeLight_Page.php`
    ln 7 – wp_enqueue_script is called
   directly.
 * `w3-total-cache/Extension_NewRelic_Widget.php`
    ln 42 – wp_enqueue_script is 
   called directly.
 * `w3-total-cache/PageSpeed_Plugin_Widget.php`
    ln 36 & ln 39 – wp_enqueue_script
   is called directly.
 * `w3-total-cache/PgCache_Page_CookieGroups.php`
    ln 8 & ln 9 – wp_enqueue_script
   is called directly.
 * The correct way to load js is via an action:
    [https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts](https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts)
 * Thank you

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-was-called-incorrectly-3/#post-11413683)
 * Hello [@stevemullen](https://wordpress.org/support/users/stevemullen/),
 * Thank you for bringing this to our attention. We are working on this and it will
   be fixed in future releases.
    Thank you!

Viewing 1 replies (of 1 total)

The topic ‘PHP Notice: wp_enqueue_script was called incorrectly’ is closed to new
replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [PHP Warning](https://wordpress.org/support/topic-tag/php-warning/)
 * [wp_enqueue_script](https://wordpress.org/support/topic-tag/wp_enqueue_script/)

 * 1 reply
 * 2 participants
 * Last reply from: [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-was-called-incorrectly-3/#post-11413683)
 * Status: resolved