Is there a function that can check if an enqueued script has a call to wp_localize_script attached to it?
1 Answer
Try this:
function is_localized($tag) {
global $wp_scripts;
$data = $wp_scripts->get_data( $tag, 'data' );
return ! empty( $data );
}
-
As I'm facing a related question right now: There's no
l10npart insideextra(anymore?). It'sarray( 'data', 'group' );.kaiser– kaiser2012-08-02 02:11:56 +00:00Commented Aug 2, 2012 at 2:11 -
1@kaiser this stuff keeps changing, updated codeRarst– Rarst2012-08-02 19:07:18 +00:00Commented Aug 2, 2012 at 19:07