Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/plugin dir url


Gets the URL (with trailing slash) for the plugin __FILE__ passed in


<?php $url plugin_dir_url$file ); ?>


(string) (required) The filename of the plugin (__FILE__)
Default: None

Return Values

The URL of the directory that contains the plugin, including a trailing slash ("/")

Change Log

Since: 2.8

Source File

plugin_dir_url() is located in wp-includes/plugin.php


Plugin paths: plugins_url(), plugin_dir_url(), plugin_dir_path(), plugin_basename()

WordPress Directories:
home_url() Home URL http://www.example.com
site_url() Site directory URL http://www.example.com or http://www.example.com/wordpress
admin_url() Admin directory URL http://www.example.com/wp-admin
includes_url() Includes directory URL http://www.example.com/wp-includes
content_url() Content directory URL http://www.example.com/wp-content
plugins_url() Plugins directory URL http://www.example.com/wp-content/plugins
theme_url() Themes directory URL (#18302) http://www.example.com/wp-content/themes
wp_upload_dir() Upload directory URL (returns an array) http://www.example.com/wp-content/uploads
See also index of Function Reference and index of Template Tags.