Call to undefined function get_blog_option()

In the functions.php of my plugin I’ve added the following code:

function relativePathForUploads( $fileinfo )
{
    global $blog_id;
    $path = get_blog_option($blog_id,'siteurl');

    $fileinfo['url'] = str_replace($path,'',$fileinfo['url']);

    return $fileinfo;
}

add_filter('wp_handle_upload', 'relativePathForUploads');

But in the error log I get the following message:

Read More
PHP Fatal error:  Call to undefined function get_blog_option()

Do I need to include something before I’m able to call get_blog_option? If so, what?

Related posts

Leave a Reply

1 comment

  1. I think that function is only available in multisite mode. Try:

    if(is_multisite()){
      $path = get_blog_option($blog_id,'siteurl');
    }else{
      $path = get_option('siteurl');`
    }