{"id":7883,"date":"2021-02-19T15:58:21","date_gmt":"2021-02-19T14:58:21","guid":{"rendered":"https:\/\/www.welaunch.io\/en\/?post_type=faq&#038;p=7883"},"modified":"2021-11-16T21:52:37","modified_gmt":"2021-11-16T20:52:37","slug":"custom-taxonomy-translation-base-url-filter","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/custom-taxonomy-translation-base-url-filter\/","title":{"rendered":"Custom Taxonomy Translation Base URL Filter"},"content":{"rendered":"<p>Some taxonomies add a custom rewrite rule to their newly registered taxonomies. In order to add the correct translated rewrite base you need to use the following filter:<\/p>\n<pre>add_filter( 'wordpress_multilingual_multisite_taxonomy_base', 'we_change_faq_topic_taxonomy_base', 20, 3 );\nfunction we_change_faq_topic_taxonomy_base( $base, $taxonomy, $blog_id ) {\n\n\tif($taxonomy !== \"faq_topics\" && $taxonomy !== \"faq\") {\n\t\treturn $base;\n\t}\n\n\t\/\/ Category \/ Term \n\tif($taxonomy == \"faq_topics\") {\n\t\tif($blog_id == 11) {\n\t\t\t$base = 'wissensdatenbank\/topics\/';\n\t\t} elseif($blog_id == 8) {\n\t\t\t$base = 'knowledge-base\/topics\/';\n\t\t}\n\t\/\/ Post Type\n\t} elseif($taxonomy == \"faq\") {\n\t\tif($blog_id == 11) {\n\t\t\t$base = 'wissensdatenbank\/faq\/';\n\t\t} elseif($blog_id == 8) {\n\t\t\t$base = 'knowledge-base\/faq\/';\n\t\t}\n\t}\n\n\treturn $base;\n\n}\n<\/pre>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-7883","faq","type-faq","status-publish","hentry","faq_topics-multilingual-multisite","faq_topics-multilingual-multisite-faq"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/7883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=7883"}],"version-history":[{"count":2,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/7883\/revisions"}],"predecessor-version":[{"id":10121,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/7883\/revisions\/10121"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=7883"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=7883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}