One database, two blogs trouble
-
I have two blogs, news and magazine, mapped to the wordpress database using wp_ and wp2_ prefixes respectively.
I already created a custom loop by simply copy pasting the default loop opration (while(have_posts()…), and this works well for the first blog which uses wp_ table prefix.
For my second blog though, I cant seem to access the respective tables (wp2_).
I tried using:
`global $wpdb;
$wpdb->set_prefix(‘wp2_’);`
before the loop, but this didn’t really work.I used print_r to see what was inside $wpdb, and indeed there are some values that are changed thanks to set_prefix. But when the loop runs I still get the original blog, or the ones with table prefix ‘wp_’.
Can anyone give any ideas?
- The topic ‘One database, two blogs trouble’ is closed to new replies.