├── .gitignore ├── README.md ├── admin └── settings.php ├── assets ├── screenshot-1.jpg ├── screenshot-2.jpg ├── screenshot-3.png └── wpml-ready-badge.png ├── css └── settings.css ├── images └── pieterbos.jpg ├── inc ├── dictionary.php └── functions.php ├── languages ├── so-pinyin-slugs-nl_NL.mo ├── so-pinyin-slugs-nl_NL.po ├── so-pinyin-slugs-zh_CN.mo ├── so-pinyin-slugs-zh_CN.po ├── so-pinyin-slugs.po └── so-pinyin-slugs.pot ├── readme.txt └── so-pinyin-slugs.php /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pinyin Slugs 2 | 3 | [](https://wordpress.org/plugins/so-pinyin-slugs) [](https://plugintests.com/plugins/so-pinyin-slugs/latest) [](https://plugintests.com/plugins/so-pinyin-slugs/latest) 4 | 5 | ###### Last updated on April 27, 2025 6 | ###### tested up to WP 6.8 7 | ###### Authors: [Pieter Bos](https://github.com/senlin) 8 | ###### [Stable Version](https://wordpress.org/plugins/so-pinyin-slugs) (via WordPress Plugins Repository) 9 | ###### [Plugin homepage](https://so-wp.com/plugin/pinyin-slugs) 10 | 11 | WordPress plugin that transforms both Simplified and Traditional Chinese character titles into a permalink friendly slug, showing pinyin that can be read by humans and (Chinese) search engines alike. 12 | 13 | ## Description 14 | 15 | Chinese characters don't come out good in permalinks. Without the Pinyin Slugs plugin activated, the example post I made for the screenshot will get a slug like this: *%e6%90%9c%e7%b4%a2%e5%bc%95%e6%93%8e%e4%bc%98%e5%8c%96*. With the plugin the slug automatically becomes *sousuoyinqingyouhua*. 16 | 17 | Search engines such as [Baidu](https://www.baidu.com) cannot make much of the first slug, but they can handle pinyin perfectly, especially when it is written as one long string without hyphens or underscores. 18 | 19 | It is possible to limit the amount of characters in the slug. The default is 100, which should be plenty for most. 20 | 21 | The Pinyin Slugs plugin was forked from the [Pinyin Permalinks](https://wordpress.org/plugins/pinyin-permalink/) plugin by user [xiaole_tao](https://profiles.wordpress.org/xiaole_tao/) as that project seemed abandoned. There have been many improvements since; read the changelog for details. 22 | 23 | ### WPML Compatible 24 | 25 | The Pinyin Slugs plugin has received the [WPML Certification of Compatibility](https://wpml.org/plugin/so-pinyin-slugs/). 26 | 27 | [](https://wpml.org/plugin/so-pinyin-slugs/) 28 | 29 | ## Frequently Asked Questions 30 | 31 | ### Does Pinyin Slugs work with Simplified Chinese characters? 32 | 33 | Yes, the plugin transforms Simplified Chinese slugs into pinyin. 34 | 35 | ### Does Pinyin Slugs work with Traditional Chinese characters? 36 | 37 | Yes, since September 2020 the plugin also can transform Traditional Chinese slugs into pinyin. 38 | 39 | ### Does Pinyin Slugs work with the WP block editor? 40 | 41 | Yes, it does, although one caveat is that to be able to see the change of slug, the post/page first needs to be saved. The same applies for edits. 42 | 43 | ### Known Issues 44 | 45 | Pinyin Slugs will not transform existing slugs, you will have to change them manually. 46 | 47 | ### I have an issue with this plugin, where can I get support? 48 | 49 | Please open an issue here on [Github](https://github.com/senlin/pinyin-slugs/issues) 50 | 51 | ## Contributions 52 | 53 | This repo is open to _any_ kind of contributions. 54 | 55 | ## License 56 | 57 | * License: GNU Version 2 or Any Later Version 58 | * License URI: http://www.gnu.org/licenses/gpl-2.0.html 59 | 60 | ## Donations 61 | 62 | * Donate link: https://so-wp.com/plugins/donations 63 | 64 | ## Connect with me through 65 | 66 | [BHI Localization for Websites](https://www.bhi-localization.com) 67 | 68 | [SO WP](https://so-wp.com) 69 | 70 | [Github](https://github.com/senlin) 71 | 72 | [LinkedIn](https://www.linkedin.com/in/pieterbos83/) 73 | 74 | [WordPress](https://profiles.wordpress.org/senlin/) 75 | 76 | ## Changelog 77 | 78 | ### 2.3.5 79 | 80 | * date: April 27, 2025 81 | * removed redundant `load_plugin_textdomain()` function and increased min required WP version 82 | * tested up to WP 6.8 83 | 84 | ### 2.3.4 85 | 86 | * date: March 11, 2025 87 | * fix [issue27](https://github.com/senlin/pinyin-slugs/issues/27) thanks for the PR @yabwee 88 | * tested up to WP 6.7 89 | 90 | ### 2.3.3 91 | 92 | * date: July 9, 2024 93 | * add new $autoload parameter (WP 6.6) 94 | * tested up to WP 6.6 95 | * removed logo from Settings page 96 | 97 | ### 2.3.2 98 | 99 | * date: November 27, 2023 100 | * last security fix introduced problem where spaces in Title where no longer replaced by hyphens, this version brings back those hyphens ([issue 23](https://github.com/senlin/pinyin-slugs/issues/23) thanks for pointing it out @nhimthaoan) 101 | 102 | ### 2.3.1 103 | 104 | * date: November 23, 2023 105 | * security fix CVE-2023-47511 Cross Site Scripting (XSS) vulnerability ([issue 22](https://github.com/senlin/pinyin-slugs/issues/22) thanks for pointing it out @ramiror) 106 | 107 | ### 2.3.0 108 | 109 | * date: August 27, 2023 110 | * fix Slug Length function ([issue 19](https://github.com/senlin/pinyin-slugs/issues/19) thanks for reporting @zhouLife) 111 | 112 | ### 2.2.1 113 | 114 | * date: October 25, 2022 115 | * edits in readme files and on Settings page 116 | 117 | ### 2.2.0 118 | 119 | * date: September 16, 2020 120 | * dictionary update: UniHan database using the kMandarin Reading field as pinyin phonetic keys (https://unicode.org/charts/unihan.html); with many thanks to [Yun-yu Shen @ujamer](https://github.com/senlin/pinyin-slugs/pull/16) 121 | * edits in readme files and on Settings page 122 | 123 | ### 2.1.4 124 | 125 | * date: October 29, 2018 126 | * tested up to WP 5.0 127 | * tested up to ClassicPress 1.0.0 128 | 129 | ### 2.1.3 130 | 131 | * date: July 8, 2018 132 | * tested up to WP 4.9.7 133 | 134 | ### 2.1.2 135 | 136 | * date: March 15, 2017 137 | * add sanitize_title filter once the file has been included as per [suggestion](https://github.com/senlin/so-pinyin-slugs/issues/6#issuecomment-284342159) of Polylang author [@Chouby](https://github.com/Chouby) 138 | * tidying up 139 | 140 | ### 2.1.1 141 | 142 | * date: November 29, 2016 143 | * remove version check 144 | * tested up to WP 4.7 145 | 146 | ### 2.1.0 147 | 148 | * date: March 10, 2016 149 | * fix to not ignore alphanumerical characters by [vanabel](https://github.com/vanabel), closes [issue #4](https://github.com/senlin/so-pinyin-slugs/issues/4) 150 | 151 | ### 2.0.4 152 | 153 | * date: August 7, 2015 154 | * TWEAK: header settings page; only showed half logo after 2.0.3 update 155 | 156 | ### 2.0.3 157 | 158 | * date: August 5, 2015 159 | * changed header settings page to h1 (https://make.wordpress.org/plugins/2015/08/03/4-3-change-to-plugin-dashboard-pages/) 160 | * show 4.3 compatibility 161 | 162 | ### 2.0.2 163 | 164 | * date: June 19, 2015 165 | * revert to [semantic versioning](http://semver.org/) 166 | 167 | ### 2.0.1 168 | 169 | * date: April 9, 2015 170 | * changed logos 171 | * new banner image for WP.org Repo by [Joschko Hammermann](https://unsplash.com/hmmrmnn) 172 | 173 | ### 2.0.0 174 | 175 | * date: July 29, 2014 176 | * due to non-compatibility issues with WP 4.0, complete rewrite of the plugin from the ground up 177 | * bump minimum required WP version up to 3.8 178 | 179 | ### 1.0.1 180 | 181 | * date: December 28, 2013 182 | * fix reported [bug](https://github.com/senlin/so-pinyin-slugs/issues/1) that causes entire admin to be a maximum width of 48rem 183 | 184 | ### 1.0.0 185 | 186 | * date: December 26, 2013 187 | * tested up to WP 3.9-alpha 188 | * settings page overhaul to better match WP 3.8 style 189 | * change version number format 190 | * change links 191 | 192 | ### 0.1.3 193 | 194 | * change text domain to prepare for language packs (via Otto - http://otto42.com/el) 195 | 196 | ### 0.1.2 197 | 198 | * redo version check 199 | * change Github link 200 | * add Dutch language files 201 | * add WPML accreditation 202 | 203 | ### 0.1.1 204 | 205 | * separate dictionary.php file 206 | * add Mandarin Chinese language files 207 | * edit readme.txt and readme.md 208 | * fix textdomain issue 209 | 210 | ### 0.1 211 | 212 | * First stable release 213 | 214 | ## Screenshots 215 | 216 | Preview of settings page as well as when adding a new Post 217 | 218 |  219 | --- 220 |  221 | -------------------------------------------------------------------------------- /admin/settings.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
73 | WordPress Plugin Repository.', 'so-pinyin-slugs' ), 76 | esc_url( 'https://wordpress.org/support/view/plugin-reviews/so-pinyin-slugs' ) 77 | ); 78 | ?> 79 |
80 | 81 |82 | support via Github only.', 'so-pinyin-slugs' ), 85 | esc_url( 'https://github.com/senlin/pinyin-slugs/issues' ) 86 | ); 87 | ?> 88 |
89 | 90 | 117 | 118 |%1$s
%2$s has been deactivated.
%1$s
%2$s is gedeactiveerd.
limitation of Pinyin Slugs is that it completely ignores anything other than Chinese characters in your slug. For example: if you have a product name with a number in it, then the plugin ignores this number. You will have to add that manually to the slug if needed. Likewise, if you\'re writing an English title and you combine it with some Chinese characters, the resulting slug will only contain the pinyin of those characters; in other words the English is completely ignored.', 'pinyinslugs' ); ?>
122 | # 123 | # wpml-name: e11ad28d9aca3e20f0431670647e60d4 124 | msgid "A limitation of Pinyin Slugs is that it completely ignores anything other than Chinese characters in your slug. For example: if you have a product name with a number in it, then the plugin ignores this number. You will have to add that manually to the slug if needed. Likewise, if you're writing an English title and you combine it with some Chinese characters, the resulting slug will only contain the pinyin of those characters; in other words the English is completely ignored." 125 | msgstr "一个重要的 SO 拼音链接缺陷是,它会完全忽略非中文字符。比如,您有一个产品名称包含数字,那么拼音链接会忽略此数字。如果有必要,您需要手动的在链接中添加此数字。或者您的标题是中英文混合的,英文部分会被忽略掉。" 126 | 127 | # 128 | # 129 | # 130 | # wpml-name: 2d5b481c29ad1857efaed18df4c3338e 131 | msgid "In that case you might want to add 301 Permanent Redirects for those specific links to your .htaccess file." 132 | msgstr "这种情况下,您可能需要在您的 .htaccess 文件中为这些特定的链接加入 301 永久重定向。" 133 | 134 | # 135 | #Note: If you choose to manually rewrite the slugs of existing permalinks, then please keep in mind that the previous permalinks that have been indexed by search engines (like Google, Baidu) do not change automatically. This may impact your site ranking if you just leave it like that.', 'pinyinslugs' ); ?>
136 | # 137 | # wpml-name: 0e241381de42364353f19c670cfedfa6 138 | msgid "Note: If you choose to manually rewrite the slugs of existing permalinks, then please keep in mind that the previous permalinks that have been indexed by search engines (like Google, Baidu) do not change automatically. This may impact your site ranking if you just leave it like that." 139 | msgstr "注意: 如果您选择手动修改已生成的链接,请注意,之前的链接可能已经被搜索引擎收录(比如百度,谷歌),并不会自动修改。这将会降低您网站的评级。" 140 | 141 | # 142 | # 143 | # 144 | # wpml-name: f4d346b1e1c7ee1dff2e1be18181cc27 145 | msgid "Pinyin Slugs will only work for new slugs, not on existing slugs. You can choose to rewrite the slugs of existing permalinks manually." 146 | msgstr "SO拼音链接插件只转换新文章的链接,不会修改已经存在的拼音链接。您可以在文章链接处输入新标题并保存来生成新的拼音链接。" 147 | 148 | # 149 | # 150 | # 151 | # wpml-name: 42668a3746f7d066848a24f43dda4670 152 | msgid "Pinyin Slugs automatically transforms Chinese character titles into pinyin slugs." 153 | msgstr "SO拼音链接自动将中文字符标题转换成拼音链接" 154 | 155 | # 156 | #'; printf( __( 'I will only support this plugin through %s. Therefore, if you have any questions, need help and/or want to make a feature request, please open an issue over at Github. You can also browse through open and closed issues to find what you are looking for and perhaps even help others.
PLEASE DO NOT POST YOUR ISSUES VIA THE WORDPRESS FORUMS
Thank you for your understanding and cooperation.', 'pinyinslugs' ),
170 | # '' . __( 'Github', 'pinyinslugs' ) . ''
171 | # ); echo '
' . __( 'If you have found this plugin useful, please give it a favourable rating in the %1$s and/or consider contributing to the plugin over at %2$s', 'pinyinslugs' ), 184 | # '' . __( 'WordPress Plugin Repository', 'pinyinslugs' ) . '', 185 | # '' . __( 'Github', 'pinyinslugs' ) . '.' 186 | # wpml-name: 83a699677be92131f520b33b9ff3ee8a 187 | msgid "Rate this plugin!" 188 | msgstr "为插件评级!" 189 | 190 | # 191 | # echo '
'; printf( __( 'I will only support this plugin through %s. Therefore, if you have any questions, need help and/or want to make a feature request, please open an issue over at Github. You can also browse through open and closed issues to find what you are looking for and perhaps even help others.
PLEASE DO NOT POST YOUR ISSUES VIA THE WORDPRESS FORUMS
Thank you for your understanding and cooperation.', 'pinyinslugs' ),
192 | # '' . __( 'Github', 'pinyinslugs' ) . ''
193 | # wpml-name: 8dda2660ccb56afc5e094c872e42b004
194 | msgid "I will only support this plugin through %s. Therefore, if you have any questions, need help and/or want to make a feature request, please open an issue over at Github. You can also browse through open and closed issues to find what you are looking for and perhaps even help others.
PLEASE DO NOT POST YOUR ISSUES VIA THE WORDPRESS FORUMS
Thank you for your understanding and cooperation."
195 | msgstr "我们将仅在 %s 对此插件支持和维护。因此,如果您有任何问题,需要帮助或者功能需求,请在Github上开一个问题。您也可以通过浏览以往的问题来获得解决您问题的答案。
请不要从 WordPress 论坛发布您的问题
感谢您的理解与合作。"
196 |
197 | # echo '
'; printf( __( 'I will only support this plugin through %s. Therefore, if you have any questions, need help and/or want to make a feature request, please open an issue over at Github. You can also browse through open and closed issues to find what you are looking for and perhaps even help others.
PLEASE DO NOT POST YOUR ISSUES VIA THE WORDPRESS FORUMS
Thank you for your understanding and cooperation.', 'pinyinslugs' ),
198 | # '' . __( 'Github', 'pinyinslugs' ) . ''
199 | # ); echo '
' . __( 'If you have found this plugin useful, please give it a favourable rating in the %1$s and/or consider contributing to the plugin over at %2$s', 'pinyinslugs' ), 205 | # '' . __( 'WordPress Plugin Repository', 'pinyinslugs' ) . '', 206 | # '' . __( 'Github', 'pinyinslugs' ) . '.' 207 | # wpml-name: e7bf3af39ce20c21c2b78926b2afbd2f 208 | msgid "WordPress Plugin Repository" 209 | msgstr "WordPress 插件库" 210 | 211 | # Translators: 1 is WordPress Plugin Repository, 2 is Github 212 | # printf( '
' . __( 'If you have found this plugin useful, please give it a favourable rating in the %1$s and/or consider contributing to the plugin over at %2$s', 'pinyinslugs' ),
213 | # '' . __( 'WordPress Plugin Repository', 'pinyinslugs' ) . '',
214 | # wpml-name: ff274bd055e60ad972f41060e4f4c6f5
215 | msgid "If you have found this plugin useful, please give it a favourable rating in the %1$s and/or consider contributing to the plugin over at %2$s"
216 | msgstr "如果您觉得这个插件对您有所帮助,请在 %1$s 给一个好的评级,或者在 %2$s 帮我们一起把插件做得更好"
217 |
218 |
--------------------------------------------------------------------------------
/languages/so-pinyin-slugs.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2013 Pinyin Slugs
2 | # This file is distributed under the same license as the Pinyin Slugs package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Pinyin Slugs 0.1.2\n"
6 | "Report-Msgid-Bugs-To: https://github.com/so-wp/so-pinyin-slugs/issues\n"
7 | "POT-Creation-Date: 2013-10-29 05:52:50+00:00\n"
8 | "MIME-Version: 1.0\n"
9 | "Content-Type: text/plain; charset=UTF-8\n"
10 | "Content-Transfer-Encoding: 8bit\n"
11 | "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12 | "Last-Translator: FULL NAME %1$s %2$s has been deactivated. %1$s %2$s has been deactivated.
PLEASE DO NOT POST YOUR ISSUES VIA THE WORDPRESS FORUMS"
117 | "strong>
Thank you for your understanding and cooperation."
118 | msgstr ""
119 |
120 | #: admin/admin.php:110
121 | msgid "Support via Github"
122 | msgstr ""
123 |
124 | #: admin/admin.php:121
125 | msgid "About the Author"
126 | msgstr ""
127 |
128 | #: admin/admin.php:126
129 | msgid ""
130 | "Hi, my name is Piet Bos, I hope you like this plugin! Please check out any "
131 | "of my other plugins on SO WP Plugins"
132 | "a>. You can find out more information about me via the following links:"
133 | msgstr ""
134 |
135 | #: admin/admin.php:132
136 | msgid "Senlin Online"
137 | msgstr ""
138 |
139 | #: admin/admin.php:133
140 | msgid "WP Tips"
141 | msgstr ""
142 |
143 | #: admin/admin.php:134
144 | msgid "Google+"
145 | msgstr ""
146 |
147 | #: admin/admin.php:135
148 | msgid "LinkedIn"
149 | msgstr ""
150 |
151 | #: admin/admin.php:136
152 | msgid "Twitter: @piethfbos"
153 | msgstr ""
154 |
155 | #: admin/admin.php:138
156 | msgid "WordPress.org Profile"
157 | msgstr ""
158 |
159 | #: so-pinyin-slugs.php:63
160 | msgid ""
161 | "
PLEASE DO NOT POST YOUR ISSUES VIA THE WORDPRESS FORUMS"
117 | "strong>
Thank you for your understanding and cooperation."
118 | msgstr ""
119 |
120 | #: admin/admin.php:110
121 | msgid "Support via Github"
122 | msgstr ""
123 |
124 | #: admin/admin.php:121
125 | msgid "About the Author"
126 | msgstr ""
127 |
128 | #: admin/admin.php:126
129 | msgid ""
130 | "Hi, my name is Piet Bos, I hope you like this plugin! Please check out any "
131 | "of my other plugins on SO WP Plugins"
132 | "a>. You can find out more information about me via the following links:"
133 | msgstr ""
134 |
135 | #: admin/admin.php:132
136 | msgid "Senlin Online"
137 | msgstr ""
138 |
139 | #: admin/admin.php:133
140 | msgid "WP Tips"
141 | msgstr ""
142 |
143 | #: admin/admin.php:134
144 | msgid "Google+"
145 | msgstr ""
146 |
147 | #: admin/admin.php:135
148 | msgid "LinkedIn"
149 | msgstr ""
150 |
151 | #: admin/admin.php:136
152 | msgid "Twitter: @piethfbos"
153 | msgstr ""
154 |
155 | #: admin/admin.php:138
156 | msgid "WordPress.org Profile"
157 | msgstr ""
158 |
159 | #: so-pinyin-slugs.php:63
160 | msgid ""
161 | "