WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How could I access an usually word-press method as example $this->get_current_site(); inside of a class?

share|improve this question

get_current_site() is a (globally accessible) function (located in ms-functions.php), it's not a class method, so simply call it it by its name like you would do with any other function.

$currentSite = get_current_site();
share|improve this answer
hi thanks for your feedback I have been trying that than I get Call to undefined function get_current_site() – kakuki Oct 16 '12 at 8:04
Well, you must make sure that the file where it's located is actually included. Normally it's included automatically (in case the site is actually a multisite) via wp-settings.php which in turn gets included by the default wp-config.php. So either you aren't including wp-settings.php, your site is not a multisite, you are calling the function before ms-functions.php gets included, or you are using an old WordPress version where this functionality doesn't exist at all. – ndm Oct 16 '12 at 8:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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