How could I access an usually word-press method as example $this->get_current_site(); inside of a class?
1 Answer
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()– kakukiOct 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 defaultwp-config.php
. So either you aren't includingwp-settings.php
, your site is not a multisite, you are calling the function beforems-functions.php
gets included, or you are using an old WordPress version where this functionality doesn't exist at all.– ndmOct 16, 2012 at 8:14