WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a plugin that enqueues a script and stylesheet only on a specific admin page. It works in my dev environment and multiple production servers; however, was introduced recently to a site that is utilizing the plugin and it will not render the script or stylesheet tag to the page. Here is the code:

add_action( 'admin_enqueue_scripts', 'gf_notification_attachment_attach_script');
// actual function to enqueue
function gf_notification_attachment_attach_script(){
    global $gf_notification_attachment;
    $plugin = $gf_notification_attachment;
    if( GFForms::get_page() == 'notification_edit'){
        $script = $plugin->plugin_url . 'script';
        $script .= ( WP_DEBUG ) ? '.js' : '.min.js';
        wp_enqueue_script( $plugin->text_domain, $script, array('gform_gravityforms'), $plugin->version, true );
        wp_enqueue_style( $plugin->text_domain, $plugin->plugin_url . 'style.css', array(), $plugin->version );         

I have inserted debug code to echo $script within the conditional in the function and it lists the path correctly. I also have dumped the global $wp_scripts var to the screen after calling the enqueue and see it listed correctly along with all the other scripts in the list.

As a bit of further testing I confirmed the only 2 plugins active were Gravity Forms and my plugin (which is dependent on GF). I also activated the default 2014 theme. I also removed the dependance on the Gravity Forms (conditional check for admin page) and tried and it still will not render the script tag.

I'm at a loss here as to what could be causing it to not show on this one site. Even wp_enqueue_script works within other plugins. Any ideas? If you wish to test the plugin and have "Gravity Forms" you can download and test the full code base yourself.

share|improve this question
Just to clarify while this is used specifically as an addon to Gravity Forms this particular issue can be demonstrated independantly of Gravity Forms. – codearachnid Apr 3 '14 at 14:48
Why not just use the $hook parameter provided by anything hooked to admin_enqueue_scripts to check what page you're on? – Andrew Bartel Apr 3 '14 at 16:45
Gravity Forms does specific paging within the form editor. To WordPress it looks like 1 page but is really separated by specific sub page parameters as such page=gf_edit_forms&view=settings&subview=notification – codearachnid Apr 18 '14 at 10:57
up vote 0 down vote accepted

This ended up being a weird conflict with how no-conflict mode works in Gravity Forms. Finally, working with their support and trying n+1 combinations it turns out that conflict mode is causing the issue:

Set no conflict mode to ON will prevent extraneous scripts and styles from being printed on Gravity Forms admin pages, reducing conflicts with other plugins and themes.

In regards to using the $hook parameter for admin_enqueue_scripts mentioned in the notes it is because of how the plugin (Gravity Forms) does specific paging within the form editor. To WordPress it looks like 1 page but is really separated by specific sub page parameters as such ?page=gf_edit_forms&view=settings&subview=notification

I hope this helps someone else, look at the plugin settings/code specific to deregistering scripts.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.