WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Plugin Dependencies] Script load order bug

[Resolved] [Plugin: Plugin Dependencies] Script load order bug

  • The plugin dependencies plugin echos a script in the admin_footer action; this fires *before* admin print scripts, so this fails if we’ve followed best practice and pushed our scripts into the footer.

    The issue can easily be resolved by outputing the same javascript in the admin_print_footer_scripts action instead, using a weight greater than 10, to ensure that it goes out after any other scripts. This will continue to work with code that queues JS in the head, but will also work with JS queued in the footer.

    Replace

    add_action( 'admin_footer', array( __CLASS__, 'admin_footer' ) );

    with

    add_action( 'admin_print_footer_scripts', array( __CLASS__, 'admin_footer' ), 20 );

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Plugin Dependencies] Script load order bug’ is closed to new replies.
Skip to toolbar