So I’m using a multisite WordPress install, and trying to query posts outside of wordpress.
I’m doing so by including:
define('WP_USE_THEMES', false); require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');
After that, I change the global $wpdb variable site id, blog id and table prefix:
$wpdb->blogid = $id; $wpdb->siteid = $id; $wpdb->set_prefix($table_prefix);
from there on I would like to use query_posts and looking at the query in $wp_query it has selected the correct tables for querying however even when I try is_category with a slug I know exists I get false.
Are these functions, like is_category and query_posts using variables I haven’t changed yet in order to query a perticular site of my multisite install?
query_posts does work when no arguments are given… but when I try to give it a category id it gives no posts, even though they should be there…
- The topic ‘Query posts of multisite outside WP’ is closed to new replies.