$ctype ) { foreach ( array( 'from', 'to' ) as $direction ) { if ( $object_type == $ctype->side[ $direction ]->get_object_type() ) { p2p_delete_connections( $p2p_type, array( $direction => $object_id, ) ); } } } } }