Let's say you're in blog 75 and you want to add_post_meta() to a post in blog 36.
Is this possible? Thanks!
Let's say you're in blog 75 and you want to add_post_meta() to a post in blog 36.
Is this possible? Thanks!
Uh, no. And if it was it'd be a huge freaking security nightmare.
You may own all the blogs on your system, but on a regular WPMU setup, each blog is individually owned and administered.
We're using Donncha's sitewide plugin to aggregate posts from all blogs into a single WordPress blog. The problem is it doesn't copy the post meta.
Our template looks for the post meta topstory=yes to populate the main post. I have a button that only shows up for certain staff members who have passed a security check. (Seriously, security is not an issue here...) Now that this button shows up on every blog... short of manually creating the SQL code is there a better API solution?
I'd alter the plugin to pull the post meta as well. Probably the simplest way.
See, in your initial question, it reads like you're asking how to do this while writing a post. :)
Ok all context aside....
Basically I need to create this function in PHP... a slightly adapted version of the original add_post_meta() in WordPress
<?php add_post_meta_to_blog($post_id, $blog_id, $meta_key, $meta_value, $unique); ?>
function add_post_meta_to_blog($blog_id, $post_id, $meta_key, $meta_value, $unique)
{
switch_to_blog($blog_id);
add_post_meta($post_id, $meta_key, $meta_value, $unique);
restore_current_blog();
}
look good?