How to localize a script in WordPress

Before we localize a script, we need to register a script first. Because without this, we can not localize any script. Because to localize a script, we need a registered script handle. Here is the syntax to register a script. wp_enqueue_script( $handle:string, $src:string, $deps:array, $ver:string|boolean|null, $in_footer:boolean ) wp_enqueue_script( ‘myjs’, ‘path_to_js_file’, array( ‘jquery’ ), ‘1.0’, true… Continue reading How to localize a script in WordPress

Published
Categorized as Dev