public function clear_attachments() { foreach ($this->get_attachments() as $attachment) { $attachment->post_parent = null; $attachment->menu_order = null; $attachment->save(); } }