[wp-hackers] Proposal: standardize plugin-data path

Otto otto at ottodestruct.com
Fri Sep 26 16:58:31 GMT 2008


On Fri, Sep 26, 2008 at 10:24 AM, Mike Walsh <mike_walsh at mindspring.com> wrote:
> This was very timely as I am working on loading some plugin specific
> Javascript today.  However, I cannot for the life of me figure out why this
> doesn't work:
>
> function swimteam_admin_head()
> {
>    //  Load CSS
>    swimteam_head_css() ;
>
>    //  Load plugin Javascript
>    wp_enqueue_script('portlet',
>        plugins_url(plugin_basename(dirname(__FILE__)
>        . '/js/portlet.js')), array('jquery', 'interface')) ;
>    var_dump(plugins_url(plugin_basename(dirname(__FILE__)
>        . '/js/portlet.js'))) ;
> }

If you're hooking that to the admin_head action hook, then that's too
late. admin_print_styles and admin_print_scripts happen before
admin_head, so the enqueue is too late to do anything.

Hook to admin_init instead.


More information about the wp-hackers mailing list