
Custom post types are where a lot of WordPress sites keep their most structured, business-critical content: portfolio items, real estate listings, team member profiles, events, recipes, case studies. Unlike standard posts and pages, custom post types are often built by a theme or plugin with their own label sets, admin UI and associated taxonomies and fields, which means translating them correctly requires more than running the visible content through a translation model.
自定义文章类型实际包含哪些内容
| 成分 | 翻译处理 |
|---|---|
| 帖子标题和内容 | 翻译方式与标准帖子和页面相同。 |
| 注册标签(单数/复数名称、菜单标签) | 管理员看到的标签通常保留网站管理员的语言,而不是根据前端访问者的语言进行翻译。 |
| Custom taxonomies | 翻译方式与标准类别和标签相同,翻译后的帖子会重新链接到翻译后的术语。 |
| 附加自定义字段 | Translated field by field based on field type, the same approach used for ACF fields generally. |
| Archive and single templates | 模板本身中任何硬编码的文本,例如“相关列表”,都需要通过主题自身的本地化系统进行翻译,这与内容翻译是分开的。 |
为什么 CPT 存档需要额外关注
自定义文章类型归档页面(列出给定类型所有项目的 URL)通常有自己的别名,例如 /listings/ 或 /portfolio/,其翻译方式应与分类和页面别名相同,遵循我们指南中的逻辑。 自动翻译 WordPress URL 和别名. Missing this leaves a translated site with individual listing pages in the target language but an archive URL that is still in the source language, which is inconsistent and confusing for both visitors and search engines.
处理附加到自定义文章类型的字段
大多数实际应用中的自定义文章类型都会与 ACF 或类似的自定义字段插件配合使用,以存储结构化数据:价格、位置、规格、日期等。这些字段需要采用与我们的指南中介绍的相同的字段类型感知转换方法。 translating ACF custom fields with AI因为即使主要内容阅读正确,但如果自定义文章类型没有翻译其附加字段,则只能实现部分本地化。
How GPTranslate Handles Custom Post Types
GPTranslate 将已注册的自定义文章类型视为一级翻译目标,将其内容、分类、附加的自定义字段和存档别名作为一个整体进行翻译,而无需对每个部分进行单独配置。这是同一功能的一部分。 dynamic content translation workflow 平台内广泛使用。
Frequently Asked Questions
Do custom post type labels need translation for every visitor language?
注册标签主要面向管理员,并在 WordPress 控制面板中使用,因此通常保留网站管理员的语言;对访问者来说,重要的是他们在前端实际看到的翻译内容、模板和分类标签。
跨语言的自定义文章类型关系会发生什么变化?
将一个自定义文章类型条目与另一个自定义文章类型条目或与常规文章连接起来的关系字段,应该指向每种语言的相关条目的翻译版本,这与 ACF 关系字段的一般原则相同。
结论
Custom post types hold some of the most valuable, structured content on many WordPress sites, and translating them completely means covering content, taxonomies, attached fields and archive URLs together, not just the visible title and body. Treating a custom post type as a single translation unit, rather than translating its pieces separately and hoping they stay in sync, is what keeps this kind of content fully localized.
