Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
This will return URL of the plugin directory with a trailing slash at the end. So this can be easily used to link to the plugin directory.
Example #1:
plugin_dir_url( __FILE__ ); // Return - http://www.example.com/wp-content/plugins/plugin_name/
Example #2:
include plugin_dir_url( __FILE__ ) . 'assets/images/zytheme-logo.png'; // retrun http://www.example.com/wp-content/plugins/plugin_name/assets/images/zytheme-logo.png
Example #3:
define('PLUGIN_URL', plugin_dir_url(__FILE__)); echo PLUGIN_URL // retrun http://www.example.com/wp-content/plugins/plugin_name/
If no arguments are passed this will deliver the same result as the above function, but with or without a trailing slash at the end. This can be configured to link to files within the plugin directory; a useful shortcut.
Example #1:
plugins_url( 'img/bar.jpg' , __FILE__ ); // Return http://www.example.com/wp-content/plugins/foo/img/bar.jpg