Title: PHP Notice: wp_enqueue_script called correctly?
Last modified: April 12, 2019

---

# PHP Notice: wp_enqueue_script called correctly?

 *  Resolved [stevemullen](https://wordpress.org/support/users/stevemullen/)
 * (@stevemullen)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-called-correctly-2/)
 * 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).
   instagram-feed-pro is active on this site.
 * My problem is that WP is generating a 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. These are the instances I found:
 * instagram-feed-pro/sbi-init.php
    ln 21 – wp_enqueue_script is called directly.
   ln 25 – wp_enqueue_style 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-called-correctly-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Contributor [Craig at Smash Balloon](https://wordpress.org/support/users/craig-at-smash-balloon/)
 * (@craig-at-smash-balloon)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-called-correctly-2/#post-11422067)
 * Hey stevemullen,
 * Sorry for any confusion! Our plugin works by registering our scripts using the
   wp_enqueue_script hook as suggested. The plugin only ends up enqueuing the script
   on pages where the feed is used. That’s what you’re seeing on lines 21 and 25.
 * I think this is an accepted way of doing this. I don’t get the same errors and
   we haven’t had anyone else report this issue. In fact, it looks like the error
   you pasted refers to wp_register_script specifically.
 * Can you try deactivating other plugins to see if it fixes the issue? Does deactivating
   Instagram Feed fix this?
 * – Craig
 *  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-called-correctly-2/#post-11422388)
 * Ok – thank you
 *  Plugin Contributor [Craig at Smash Balloon](https://wordpress.org/support/users/craig-at-smash-balloon/)
 * (@craig-at-smash-balloon)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-called-correctly-2/#post-11423053)
 * No problem! Let me know if you need anything else.

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

The topic ‘PHP Notice: wp_enqueue_script called correctly?’ is closed to new replies.

 * ![](https://ps.w.org/instagram-feed/assets/icon-256x256.png?rev=2700807)
 * [Smash Balloon Social Photo Feed – Easy Social Feeds Plugin](https://wordpress.org/plugins/instagram-feed/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/instagram-feed/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/instagram-feed/)
 * [Active Topics](https://wordpress.org/support/plugin/instagram-feed/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/instagram-feed/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/instagram-feed/reviews/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Craig at Smash Balloon](https://wordpress.org/support/users/craig-at-smash-balloon/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-wp_enqueue_script-called-correctly-2/#post-11423053)
 * Status: resolved