Inpsyde\MultilingualPress\API\WPDBContentRelations::has_site_relations PHP Method

has_site_relations() public method

Checks if the site with the given ID has any relations of the given (or any) content type.
Since: 3.0.0
public has_site_relations ( integer $site_id, string $type = '' ) : boolean
$site_id integer Site ID.
$type string Optional. Content type. Defaults to empty string.
return boolean Whether or not the site with the given ID has any relations of the given (or any) content type.
    public function has_site_relations($site_id, $type = '')
    {
        $args = [$site_id];
        $query = "SELECT ml_id FROM {$this->table} WHERE ml_blogid = %d AND ml_source_blogid != ml_blogid";
        if ($type) {
            $query .= ' AND ml_type = %s';
            $args[] = $type;
        }
        return (bool) $this->db->query($this->db->prepare("{$query} LIMIT 1", $args));
    }