我正在使用WPML插件翻译我的网站。我有一个名为“vinos”的自定义帖子类型,我使用以下参数:
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'supports\' => array(\'title\', \'thumbnail\'),
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 6,
\'show_in_nav_menus\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false,
\'has_archive\' => \'nuestros-vinos/catalogo\',
\'query_var\' => true,
\'can_export\' => true,
\'capability_type\' => \'post\',
\'rewrite\' => array(\'slug\' => \'nuestros-vinos/catalogo/marcas/%marcas%\')
);
register_post_type(\'vinos\', $args);
问题是我无法将字符串“nuestros vinos/catalogo/marcas”翻译为英语,因此我的URL为:
www.domain。com/nuestros-vinos/catalogo/>在spanishwww上显示我所有的葡萄酒列表。领域com/en/nuestros vinos/catalogo/>用英语显示我所有的葡萄酒列表
但我希望英文版的网址是:
www.domain。com/en/我们的葡萄酒/目录/
我正在尝试使用重写规则:
add_filter(\'generate_rewrite_rules\', \'customposttype_rewrites\');
function customposttype_rewrites($wp_rewrite) {
$newrules = array();
$newrules[\'en/our-wines/catalog/?$\'] = \'en/index.php?post_type=vinos\';
$wp_rewrite->rules = $newrules + $wp_rewrite->rules;
}
但它不起作用,总是找不到页面。
我该怎么做?
谢谢