1

Is there a function that can check if an enqueued script has a call to wp_localize_script attached to it?

1 Answer 1

1

Try this:

function is_localized($tag) {

    global $wp_scripts;

    $data = $wp_scripts->get_data( $tag, 'data' );

    return ! empty( $data );
}
2
  • As I'm facing a related question right now: There's no l10n part inside extra (anymore?). It's array( 'data', 'group' );.
    – kaiser
    Commented Aug 2, 2012 at 2:11
  • 1
    @kaiser this stuff keeps changing, updated code
    – Rarst
    Commented Aug 2, 2012 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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