HooksQuery execution hooks
Query execution hooks
Gato AI Translations for Polylang executes GraphQL queries to accomplish all of its logic:
- Creating missing translation entries (posts, categories, tags, etc)
- Synchronizing data between languages
- Translating content
Your application can react to the execution of the queries via the following action hooks:
gatompl:query_execution_start
gatompl:query_execution_end
The hooks receive the following parameters:
Parameter | Description | Example |
---|---|---|
$querySlug | Slug of the query to execute | translate-customposts |
$queryVariables | Variables passed to the query | ['customPostIds' => [123, 456], ...] |
gatompl:query_execution_start
Triggered right before the query is executed.
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
Triggered right after the query is executed.
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
);
Query slugs
The supported query slugs are:
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