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:

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?

1 Answer 1


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

  $path = get_blog_option($blog_id,'siteurl');
  $path = get_option('siteurl');`
  • Thanks! Makes perfect sense, why else would you need a blog Id. Must have missed it in the reference manual.
    – Luke
    Jul 7, 2011 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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