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

get_element_for_site() public method

Return the term taxonomy ID of the given target site for the given source term.
public get_element_for_site ( integer $source_site_id, integer $target_site_id, integer $source_content_id, string $type ) : integer
$source_site_id integer Source blog ID.
$target_site_id integer Target blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$type string Content type.
return integer
    public function get_element_for_site($source_site_id, $target_site_id, $source_content_id, $type)
    {
        $sql = "\nSELECT t.ml_elementid\nFROM {$this->table} s\nINNER JOIN {$this->table} t\nON s.ml_source_blogid = t.ml_source_blogid\n\tAND s.ml_source_elementid = t.ml_source_elementid\n\tAND s.ml_type = t.ml_type\nWHERE s.ml_id != t.ml_id\n\tAND s.ml_blogid = %d\n\tAND s.ml_elementid = %d\n\tAND s.ml_type = %s\n\tAND t.ml_blogid = %d\nLIMIT 1";
        $query = $this->db->prepare($sql, $source_site_id, $source_content_id, $type, $target_site_id);
        return (int) $this->db->get_var($query);
    }