Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1317915
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 1 year ago.
Improve this questionI have created a plug-in which permits to create a category with slugs.
There is the code :
wp_insert_term(
'Cat1',
'category',
array(
'slug' => 'slug-cat1',
));
wp_insert_term(
'Agenda',
'category',
array(
'slug' => 'slug-agenda',
'parent'=> term_exists( 'Cat1', 'category' )['term_id']
));
It permits to create my category in the default language of the website. So my question is, do you know how can i create a category as before, but i want to create it in another language than the default. I'm using Polylang to translate my website.
Have a good day.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 1 year ago.
Improve this questionI have created a plug-in which permits to create a category with slugs.
There is the code :
wp_insert_term(
'Cat1',
'category',
array(
'slug' => 'slug-cat1',
));
wp_insert_term(
'Agenda',
'category',
array(
'slug' => 'slug-agenda',
'parent'=> term_exists( 'Cat1', 'category' )['term_id']
));
It permits to create my category in the default language of the website. So my question is, do you know how can i create a category as before, but i want to create it in another language than the default. I'm using Polylang to translate my website.
Have a good day.
Share Improve this question asked May 9, 2019 at 13:57 TweakTweak 311 silver badge8 bronze badges2 Answers
Reset to default 2You can actually make it this way:
$cat1 = wp_insert_term(
'Cat1',
'category',
['slug' => 'slug-cat1'],
);
$agenda = wp_insert_term(
'Agenda',
'category',
[
'slug' => 'slug-agenda',
'parent'=> term_exists( 'Cat1', 'category' )['term_id'],
],
);
pll_set_term_language($cat1['term_id'], 'fr');
pll_set_term_language($agenda['term_id'], 'de');
Here is link to Polylang Function reference: https://polylang.wordpress/documentation/documentation-for-developers/functions-reference/
Unfortunately, you need to buy the pro-version of Polylang. This is a feature, which the pro-version of the plugin provides for custom post types.
That is one of the tricks, which make people buy the pro-version.
I think Polylang pro-version starts at 99,- € (depending on your needs).
In comparison: WPML has the same features (and more) with only 79,- € I think. I have recently encountered the same problem and the cheapeast solution, was to buy the pro of WPML.
I know the answer might be not satisfying, but that's how it currently is.
本文标签: categoriesHow can i insert term in a specific language of Polylang
版权声明:本文标题:categories - How can i insert term in a specific language of Polylang? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742024247a2415243.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论