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

1 Answer 1


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();
  • hi thanks for your feedback I have been trying that than I get Call to undefined function get_current_site()
    – kakuki
    Oct 16, 2012 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, 2012 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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