Title: javascript plugin location
Last modified: August 20, 2016

---

# javascript plugin location

 *  [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/javascript-plugin-location/)
 * I’ve been developing plugins and happily been using:
    `$pluginurl = WP_PLUGIN_URL.'/'.
   str_replace(basename( __FILE__),"",plugin_basename(__FILE__));`
 * to get to my plugin location.
 * However what I am doing is using javascript to link to a location however, right
   now to do that I need to put in the full absolute url, is there a way to get 
   the plugin url with javascript?
 * Thanks,
 * Versi

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/javascript-plugin-location/#post-2650732)
 * You can still get your Plugin location with PHP, and then pass it to your JavaScript
   using localization:
 * [http://codex.wordpress.org/Function_Reference/wp_localize_script](http://codex.wordpress.org/Function_Reference/wp_localize_script)
 *  Thread Starter [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/javascript-plugin-location/#post-2650735)
 * Im not really very good at getting my js to work with php – the JS in question
   is in an external javascript file not in a php one
 * As some people say to use a .php and then a javascript header but I can’t get
   this to work at all
    `header("content-type: application/x-javascript");`
 * but my javascript then doesnt work at all.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘javascript plugin location’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Versipellis](https://wordpress.org/support/users/versipellis/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/javascript-plugin-location/#post-2650735)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
