You are here

26 April 2011

This example shows you how to get base URL of your wordpress powered website. It takes the value from your site information which can be modified and was set during the installation of WordPress.

Source code viewer
  1. /*
  2.  * Get wordpress base url.
  3.  *
  4.  * What else can you get from bloginfo function.
  5.  * http://codex.wordpress.org/Function_Reference/bloginfo
  6.  *
  7.  * What else can you get from get_bloginfo function.
  8.  * http://codex.wordpress.org/Function_Reference/get_bloginfo
  9.  */
  10.  
  11. echo home_url();
  12. // or
  13. bloginfo( 'url' );
  14. // or
  15. echo get_bloginfo( 'url' );
  16.  
Programming Language: PHP