Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress Plugin development

Tags:

wordpress

I am developing a wordpress plugin.

In this plugin I am trying to get the hostname of the server.

Is this possible?

I see tags/filters like:

  • get_home_url
  • get_site_url
  • home_url
  • get_page_link

But they do not seem to work in plugins.

like image 499
Mark Avatar asked Aug 26 '26 01:08

Mark


2 Answers

I would just use the PHP $_SERVER predefined variable rather than worry about whether a WP function is available or not.

echo $_SERVER['SERVER_NAME'];

will give you something like: www.example.com

http://www.php.net/manual/en/reserved.variables.server.php

like image 164
Steve Claridge Avatar answered Aug 28 '26 17:08

Steve Claridge


I think you could use bloginfo('url'); wich gets the baseurl or are you looking for something else

like image 22
zendy Avatar answered Aug 28 '26 17:08

zendy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!