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/)
 * I am investigating plugins on my site that are not loading scripts and styles
   correctly. multisite-enhancements is active on this site, and while reading that
   plugin code, I cam across this:
 * inc/autoload/class-add-css.php:
    `add_action( 'admin_head-themes.php', array(
   $this, 'enqueue_style' ) );`
 * I know that the [correct way to enqueue scripts](https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts)
   and styles is to use one of the action hooks ‘wp_enqueue_scripts’, ‘admin_enqueue_scripts’,
   or ‘login_enqueue_scripts’. What I’m not clear on, is if you’ve created an action
   called ‘admin_head-themes.php’ that is allowing you to do this the proper way.
   Or maybe this is just old code that needs to be updated to the newer way of loading.
 * 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`
 * Your thoughts on this would be appreciated.
 * 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%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 * ![](https://ps.w.org/multisite-enhancements/assets/icon-256x256.png?rev=1429634)
 * [Multisite Enhancements](https://wordpress.org/plugins/multisite-enhancements/)
 * [Support Threads](https://wordpress.org/support/plugin/multisite-enhancements/)
 * [Active Topics](https://wordpress.org/support/plugin/multisite-enhancements/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multisite-enhancements/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multisite-enhancements/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * 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-called-correctly/)
 * Status: resolved