wordpress url functions


There are many url functions in wordpress which will tell you what is the address of different directories in wordpress.

wordpress url function
wordpress url function

Let me discuss each of these:-
plugins_url() gives you address of plugins directory. For example http://www.yoursite.com/wp-content/plugins
includes_url() gives you address of wp-includes directory. For example http://www.yoursite.com/wp-includes
content_url() gives you address of wp-content directory. For example http://www.yoursite.com/wp-content
admin_url() gives you address of wp-admin directory. For example http://www.yoursite.com/wp-admin
site_url() gives you address of your site. For example http://www.yoursite.com
home_url() gives you address of your site. For example http://www.yoursite.com
There is slight difference between site_url() and home_url(). Suppose you have saved your core files in wp directory and you want that your website address should be http://www.yoursite.com not http://www.yoursite.com/wp then the home_url() value will be http://www.yoursite.com and it is saved in wp-options table.


Leave a Comment

Your email address will not be published. Required fields are marked *