admin管理员组文章数量:1292285
Sometimes I have duplicate IDs between Post Types and Taxonomies, I know this happens because they are stored in different tables but I wish it was possible to have a unique ID for each thing in WP, is there a way to achieve this?
Sometimes I have duplicate IDs between Post Types and Taxonomies, I know this happens because they are stored in different tables but I wish it was possible to have a unique ID for each thing in WP, is there a way to achieve this?
Share Improve this question asked May 21, 2021 at 17:54 NicolaNicola 1278 bronze badges 4 |1 Answer
Reset to default 0The only way I could think to achieve this would be to query the DB and build a list of ids, then check to make sure none of the ids match, but that might be a very taxing query. You would also need to change the way the id's for each table would be updated which could get a bit messy, but I believe it's possible it would just take quite a bit of effort.
You might be able to use something like: https://developer.wordpress/reference/functions/wp_unique_id/ to increment your unique ids, but this will probably take a lot of effort.
本文标签: taxonomyUnique IDs for Post Types and Taxonomies
版权声明:本文标题:taxonomy - Unique IDs for Post Types and Taxonomies 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741543912a2384482.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
wp_posts.ID
is one, but what is the other? Also, can you explain your use case here? I can't think of any reasonable means to do this, and I can't think of a reason to want to do this. – phatskat Commented May 21, 2021 at 18:07id | type | language | translation
. Then when you make a translation, add a row for the given object ID and type (e.g. ID = 20, type = post or ID = 1001, type = term), translation, and language. When the language changes, use that reference table to pull the translated values. There are also plugins for this kind of thing. Beyond that, you should show what you've tried and where you're stuck if you want to get any useful answers. – phatskat Commented May 21, 2021 at 19:58