Ticket #1097: added copy_relations function so that plugin will work both on draft and published pages