훅쿼리 실행 훅
쿼리 실행 훅
Gato AI Translations for Polylang은 모든 로직을 수행하기 위해 GraphQL 쿼리를 실행합니다.
- 누락된 번역 항목 생성 (포스트, 카테고리, 태그 등)
- 언어 간 데이터 동기화
- 콘텐츠 번역
애플리케이션은 다음 액션 훅을 통해 쿼리 실행에 반응할 수 있습니다.
gatompl:query_execution_startgatompl: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-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
Prev
Next