I am trying to find the hostname of the sql using wordpress. ie I wanted to print the 'localhost' from 'http://**localhost**/velocity/wordpress/?page_id=4'
I tried the function home_get_url(), but I got the entire path as shown above. When I was trying with gethostname() I got my PC name. '
Please help. I am a fresher to wordpress.
You can use
$_SERVER['HTTP_HOST']
For
http://localhost/velocity/wordpress/?page_id=4
it will returnhttp://localhost