0

How i can get the base URL in the wordpress? get_bloginfo('url') returns me the current URL. I just want the base URL e.g http://localhost/wpsite/ not any ?page_id=123 with it

1

Use site_url

<?php echo site_url(); ?>

http://codex.wordpress.org/Function_Reference/site_url

Or get_site_url

<?php echo get_site_url(); ?>

http://codex.wordpress.org/Function_Reference/get_site_url

Or even home_url

<?php echo home_url(); ?>

http://codex.wordpress.org/Function_Reference/home_url

which returns the home URL for the site.

Check the doc links for differences in available parameters.

0

You are looking for site_url() or home_url()

1
  • 1
    You might get upvotes if you explain the difference and when to use which function. – fuxia Sep 20 '12 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.