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_startgatompl: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-categoriescreate-missing-translation-custompostscreate-missing-translation-mediacreate-missing-translation-tagssync-category-meta-entry-deletionsync-custompost-categoriessync-custompost-featuredimagesync-custompost-meta-entry-deletionsync-custompost-tagssync-tag-meta-entry-deletiontranslate-categoriestranslate-custompoststranslate-mediatranslate-tags