Inpsyde\MultilingualPress\API\WPDBSiteRelations::delete_relation PHP Method

delete_relation() public method

Deletes the relationship between the given sites. If only one site is given, all its relations will be deleted.
Since: 3.0.0
public delete_relation ( integer $site_1, integer $site_2 ) : integer
$site_1 integer Site ID.
$site_2 integer Optional. Another site ID. Defaults to 0.
return integer The number of rows affected.
    public function delete_relation($site_1, $site_2 = 0)
    {
        $query = "DELETE FROM {$this->table}";
        if (!$site_2) {
            $query .= " WHERE site_1 = %d OR site_2 = %d";
            $args = [$site_1, $site_1];
        } else {
            $query .= " WHERE (site_1 = %d AND site_2 = %d) OR (site_1 = %d AND site_2 = %d)";
            $args = [$site_1, $site_2, $site_2, $site_1];
        }
        $query = $this->db->prepare($query, $args);
        return (int) $this->db->query($query);
    }