Take the 2-minute tour ×

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

share|improve this question

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();
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


