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


Try this:

function is_localized($tag) {

    global $wp_scripts;

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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