WordPress + polylang – Globalization

Tables

wp_posts: posts

wp_terms: post category, menu

wp_term_taxonomy: term type (taxonomy), language (description), hierarchy, number of posts associated to it

wp_term_relationships: relationship between post-taxonomy,category-taxonomy

when polylang activated

wp_terms: add language rows:

zh – post language,

pll_zh-category language

wp_term_relationships

all posts and categories would add rows to this table in order to identify the relationships.

INSERT INTO `wp_terms` (`term_id`, `name`, `slug`, `term_group`) VALUES
(3, 'Socials Top Menu', 'socials-top-menu', 0),
(33, '报道', 'report', 0),
(38, 'English', 'enca', 2),
(39, 'English', 'pll_enca', 0),
(40, 'pll_5b343bccc90ae', 'pll_5b343bccc90ae', 0),
(41, '中文 (中国)', 'zh', 0),                    --zh post language
(42, '中文 (中国)', 'pll_zh', 0),                --pll_zh term language
(99, 'Report', 'report-calendar-enca', 0);

INSERT INTO `wp_term_taxonomy` (`term_taxonomy_id`, `term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES
(3, 3, 'nav_menu', '', 0, 7),
(33, 33, 'category', '', 13, 56),
(38, 38, 'language', 'a:3:{s:6:\"locale\";s:5:\"en_CA\";s:3:\"rtl\";i:0;s:9:\"flag_code\";s:2:\"ca\";}', 0, 2),
(39, 39, 'term_language', '', 0, 16),
(40, 40, 'term_translations', 'a:2:{s:4:\"enca\";i:99;s:2:\"zh\";i:33;}', 0, 2),
(41, 41, 'language', 'a:3:{s:6:\"locale\";s:5:\"zh_CN\";s:3:\"rtl\";i:0;s:9:\"flag_code\";s:2:\"cn\";}', 0, 9),
(42, 42, 'term_language', '', 0, 17),
(99, 99, 'category', '', 73, 0);

INSERT INTO `wp_term_relationships` (`object_id`, `term_taxonomy_id`, `term_order`) VALUES
(33, 3, 0), --nav_menu
(33, 40, 0), --term_translations
(33, 42, 0), --term_language
(43, 33, 0), --category
(54, 33, 0), --term_translations a:2:{s:4:"enca";i:53;s:2:"zh";i:20;}
(99, 39, 0), --category:Report
(379, 41, 0);      --post

Add language row for posts after activating polylang

INSERT INTO wp_term_relationships (object_id,term_taxonomy_id)
SELECT id,41 FROM `wp_posts`    --41: zh
where id not in (select object_id from wp_term_relationships where term_taxonomy_id=41)
      and post_type='post'

 

Advertisements

Leave a Reply