Two WordPress sites sharing the same database

You won’t be able to use the same database. If you do your going to have all sorts of problems. With the biggest problem being you cannot have two different values for the site URL. I would suggest a managed hosting solution such as Pantheon. This will provide you with a development, test, and live … Read more

the blog owner multisite

I use this workaround to get the ID of the owner of the current blog: $thisblog = $current_blog->blog_id; $mail = get_blog_option($thisblog, ‘admin_email’); $user_from_email = get_user_by(’email’, $mail); $user_id = $user_from_email->ID;

why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?

It turns out I was barking up the wrong (or at least a slightly different) tree by using wp_insert_attachment. media_sideload_image managed to pull attachments from other blogs on the same multisite install, copy them to the aggregating blog’s uploads directory, and generate thumbnails, while wp_insert_attachment was doing what it was supposed to, which just happened … Read more

WordPress multisite htaccess

I’ve been looking for details on why that line is suggested for a multisite install using subdomains as well. I actually question if both of these are relevant for a subdomain install: RewriteRule ^(wp-(content|admin|includes).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] In a sub-directory install the rules are setup slightly different to strip the sub-directory name … Read more

How can i get the last post from wp multisite?

The orderby-parameter should be post_date instead of date. your code would look something like this: $blogs = get_last_updated(‘ ‘, 0, 1); foreach ($blogs AS $blog) { switch_to_blog($blog[“blog_id”]); $args = array( ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘numberposts’ => 1, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘suppress_filters’ => true ); $lastposts = get_posts( $args ); foreach($lastposts … Read more

Unique post-id for WordPress Multisite Network

Yes. Use $post->guid instead of $post->ID. NB: guid must be in lowercaps for it to work. Detailed explanation here: https://wordpress.stackexchange.com/a/209832/71131 Some additional detail on the purpose of keeping $post->ID as a backup in your third-party service: https://wordpress.stackexchange.com/a/209833/71131