I am new in wordpress, doing a plug in for word press site. Here is a problem with me, i want to get plug in url with my plug in name dynamically in javascript file. Please suggest. Thanks in advance.
1 Answer
The function wp_localize_script gives you the ability to write a javaScript object with multiple variables defined. Like :
<?php wp_localize_script('some_handle', 'object_name', array( 'plugin_url' => plugins_url() )); ?>