Trouble with SQL SELECT inside switch_to_blog()
I'm using switch_to_blog() and restore_current_blog() to perform some functions across a multi site install. One of the things I'm trying to do is select a very specific post using get_row(). My function looks like this:
$prefix = $wpdb-prefix;
$tbl = $prefix;
$product = $wpdb-get_row("SELECT * FROM {$tbl}_posts WHERE ID = 4253");
print_r($product); exit;
The post with ID 4253 definitely exists, and I know for sure that the prefix is correct, however print_r returns absolutely nothing, nor does echo $product-post_title;
Any ideas?
Topic get-row switch-to-blog multisite Wordpress
Category Web