フック
フッククエリ実行フック

クエリ実行フック

Gato AI Translations for Polylang は、すべてのロジックを実現するために GraphQL クエリ を実行します。

  • 不足している翻訳エントリの作成(投稿、カテゴリー、タグなど)
  • 言語間のデータ同期
  • コンテンツの翻訳

アプリケーションは、以下のアクションフックを使用してクエリの実行に反応できます。

  • gatompl:query_execution_start
  • gatompl:query_execution_end

フックは以下のパラメーターを受け取ります。

パラメーター説明
$querySlug実行するクエリのスラッグtranslate-customposts
$queryVariablesクエリに渡される変数['customPostIds' => [123, 456], ...]

gatompl:query_execution_start

クエリが実行される直前にトリガーされます。

add_action(
  'gatompl:query_execution_start',
  /**
   * @param array<string, mixed> $queryVariables The variables passed to the query.
   */
  function (
    string $querySlug,
    array $queryVariables
): void {
    // Do something
  },
  10,
  2
);

gatompl:query_execution_end

クエリが実行された直後にトリガーされます。

add_action(
  'gatompl:query_execution_start',
  /**
   * @param array<string, mixed> $queryVariables The variables passed to the query.
   */
  function (
    string $querySlug,
    array $queryVariables
): void {
    // Do something
  },
  10,
  2
);

クエリスラッグ

サポートされているクエリスラッグは以下のとおりです。

  • create-missing-translation-categories
  • create-missing-translation-customposts
  • create-missing-translation-media
  • create-missing-translation-tags
  • sync-category-meta-entry-deletion
  • sync-custompost-categories
  • sync-custompost-featuredimage
  • sync-custompost-meta-entry-deletion
  • sync-custompost-tags
  • sync-tag-meta-entry-deletion
  • translate-categories
  • translate-customposts
  • translate-media
  • translate-tags