ConfiguratieDe slug vertalen voor een bepaald CPT, maar niet voor de andere
De slug vertalen voor een bepaald CPT, maar niet voor de andere
De plugin biedt een optie in de Instellingen om de post-slug te vertalen, die van toepassing is op alle custom post types.

Als je de slug wilt vertalen voor een bepaald custom post type, maar niet voor de andere, kun je dat doen via hook gatompl:query_variables:
add_filter(
'gatompl:query_variables',
/**
* @param array<string, mixed> $variables The variables to pass to the query.
* @return array<string, mixed> The variables to pass to the query.
*/
function (
array $variables,
string $querySlug
): array {
if ($querySlug === 'translate-customposts') {
// Definieer de CPT's waarvoor je de slug wilt vertalen
$translateSlugForCTPs = [
'my-custom-post-type',
];
/** @var string */
$customPostType = $variables['customPostType'];
$variables['updateSlug'] = in_array($customPostType, $translateSlugForCTPs);
}
return $variables;
},
10,
2
);