Check if a script/style was enqueued/registered

Is it possible to test whether a script or a style was registered using wp_register_script/_style or wp_enqueue_script/_style? All functions doesn’t return a value and I’m completely clueless.

I need it to switch between different functions depending on stylesheet-libraries and scripts I offer.

Read More

Thank you!

Related posts

Leave a Reply

2 comments

  1. Check $GLOBALS['wp_scripts']->registered for scripts.

    Example

    function is_enqueued_script( $script )
    {
        return isset( $GLOBALS['wp_scripts']->registered[ $script ] );
    }
    
    print (int) is_enqueued_script( 'l10n' );
    

    $GLOBALS['wp_styles']->registered works the same way.