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

get_translation_ids() public method

Return the existing (or new) translation IDs according to the given parameters.
public get_translation_ids ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type ) : array
$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.
$target_content_id integer Target post ID or term taxonomy ID.
$type string Content type.
return array
    public function get_translation_ids($source_site_id, $target_site_id, $source_content_id, $target_content_id, $type)
    {
        $result = $this->get_existing_translation_ids($source_site_id, $target_site_id, $source_content_id, $target_content_id, $type);
        if (!$result) {
            return $this->get_new_translation_ids($source_site_id, $source_content_id, $type);
        }
        if (1 < count($result)) {
            // We have more than one id.
            $this->clean_up_duplicated_translation_ids($result, $type);
        }
        return $result[0];
    }