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' );. Commented Aug 2, 2012 at 2:11
  • 1
    @kaiser this stuff keeps changing, updated code 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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.