WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom-built website which pulls data from WordPress.

I've included wp-blog-header.php in my page and it is all set, I can get my posts, featured image, titles, anything I want, wherever I want.

Now I'd like to add new languages to my website, so I've set up multisite so I can have one site for each language. How can I access information from a specific site? I'm using subfolder method, but there is no example.com/sub/wp-blog-header.php file to include!

Any Ideas on how to pull data of specific site on external pages?

share|improve this question
up vote 1 down vote accepted

You can use the switch_to_blog() function to switch the scope to a specific site and access data from that site:

require_once( '/path/to/wp-load.php' );
switch_to_blog( 3 );
$option = get_option( 'admin_email' );

Also, you should use wp-load.php when using WordPress API in your own project, not wp-blog-header.php

share|improve this answer

In almost the same way, you just need to set $_SERVER['REQUEST_URI'] to the URL which you would have accessed if you were accessing a single wordpress install. Wordpress parses that variable to determine which site you are trying to get to and then sets to lok only at the relevant DB tables.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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