Title: PHP Notice: wp_enqueue_script was called incorrectly
Last modified: April 12, 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-5/)
 * I am investigating plugins on my site that are not [loading scripts and styles correctly](https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts).
   wp-analytify-pro is active on this site.
 * My problem is that WP is generating a php warning because code (plugins, themes…)
   are not loading scripts and styles correctly, but the warning is not indicating
   the offending code:
    `[12-Apr-2019 12:57:45 UTC] PHP Notice: wp_register_script
   was called <strong>incorrectly</strong>. Scripts and styles should not be registered
   or enqueued until the <code>wp_enqueue_scripts</code>, <code>admin_enqueue_scripts
   </code>, or <code>login_enqueue_scripts</code> hooks. Please see <a href="https://
   codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more
   information. (This message was added in version 3.3.0.) in /home/redacted/public_html/
   wp-includes/functions.php on line 4667`
 * This plugin appears to call wp_enqueue_script directly in a handful of files.
   This is not supported and generates PHP warnings. Here is instance I found:
 * wp-analytify-pro/views/old/front/world-map-stats.php
    ln 40 – wp_enqueue_script
   is called directly.
 * Thank you
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-notice-wp_enqueue_script-was-called-incorrectly-5%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Burhan Nasir](https://wordpress.org/support/users/burhandodhy/)
 * (@burhandodhy)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-was-called-incorrectly-5/#post-11423795)
 * Hi Stevemullen,
 * I checked the line number you mentioned and there is no issue with this. Actually,
   the technique which is used is the efficient way to load the scripts only for
   the shortcode and it only called when you used the `[analytify-worldmap]` shortcode.
   This technique is also shared by the WooCommerce Developer [https://mikejolley.com/2013/12/02/sensible-script-enqueuing-shortcodes/](https://mikejolley.com/2013/12/02/sensible-script-enqueuing-shortcodes/)
 * 1) By the way, the warring error remains there after temporary deactivate the
   Analytify Pro?
    2) Are you using the `[analytify-worldmap]` shortcode anywhere
   on site?
 * Feel free to contact us at [https://analytify.io/support/](https://analytify.io/support/).
   We will be happy to investigate the issue.
 *  Thread Starter [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-5/#post-11425008)
 * Thank you !

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

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

 * ![](https://ps.w.org/wp-analytify/assets/icon-256x256.png?rev=2901093)
 * [Analytify - Google Analytics Dashboard For WordPress (GA4 analytics tracking)](https://wordpress.org/plugins/wp-analytify/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-analytify/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-analytify/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-analytify/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-analytify/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-analytify/reviews/)

## Tags

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

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