public function relate_all_posts($source_site_id, $destination_site_id) { $inserted = 0; // TODO: Restrict to "supported post types", and improve post status (e.g., `NOT IN ('trash', 'auto-draft')`?). $query = "\nINSERT INTO {$this->table} (\n\tml_source_blogid,\n\tml_source_elementid,\n\tml_blogid,\n\tml_elementid,\n\tml_type\n)\nSELECT %d, ID, %d, ID, 'post'\nFROM {$this->db->posts}\nWHERE post_status IN ('publish', 'future', 'draft', 'pending', 'private')"; foreach ([$source_site_id, $destination_site_id] as $site_id) { $inserted += (int) $this->db->query($this->db->prepare($query, $source_site_id, $site_id)); } return $inserted; }