1

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 1

5

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() )); ?>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.