Wordpress Plugin Development

I am developing a wordpress plugin.

In this plugin, I am trying to get the server host name.

Is it possible?

I see tags / filters like:

  • get_home_url
  • get_site_url
  • home_url
  • get_page_link

But they do not work in plugins.

+3
source share
3 answers

I would just use the predefined PHP variable $ _SERVER, and not worry about whether the 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

+3
source

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

+1
source

init Hook. , /.

0

All Articles