Hi,
I want to get the base url of my site (eg: http://en.forums.wordpress.com) . I have included a new php page with my plugin, get_bloginfo('wpurl') , is not working in this page. any wordpress files want to include? or any other way to get base url in wordpress?
henkholland
Member
Posted 2 years ago #
<?php
$p = getcwd();
echo $p;
?>
I did put this in a file that I saved as path.php, uploaded it to my site through ftp and called it from the browser window.
It gives a nice path ifo.
qwertysledge
Member
Posted 2 years ago #
I also had this problem and tried the above code, but it gave me the server filesystem's path. So, I poked around a bit in the header.php of my template (Fusion) and found where they write the url for Home. It was in a HREF with inline php, but the basic call was
get_settings('home')
Placing this in my customizations gave the correct behaviour. Particularly, I was interested in taking out the link to the authors page for sanitizing purposes.
qwertysledge
Member
Posted 2 years ago #
Follow-Up:
The WordPress function reference doesn't list get_settings() (perhaps deprecated), but does have an alternate and more aptly named get_blog_info(). The call with argument is
get_bloginfo('url')
Both work, but wouldn't trust the get_settings() for future versions.
References:
Function Reference
Function Reference - get_bloginfo