wp_register_script('acf-input-filter', $this->settings['dir'] . 'js/input.js', array('acf-input'), $this->settings['version']); wp_localize_script('acf-input-filter', 'acf_filter', array( 'plugin_dir' => plugins_url('',__FILE__)) );
Alright, lets break this code down a bit.
Line 2 is where we pass the data to the script we just registered. In order, the arguments are:
- The handle of the registered script you want to pass data to.
- An array of data to pass into your script.
That’s all it takes as far as the PHP is concerned.
Any data you pass through the array is added to the object for use in your scripts. It’s really that easy.