gpt4 book ai didi

mysql - WordPress 的 SQL : get all category of a post

转载 作者:行者123 更新时间:2023-11-29 04:10:43 25 4
gpt4 key购买 nike

我有一个帖子,它有多个类别,我如何通过 sql 查询获得这篇帖子的所有类别?非常感谢。

最佳答案

您可以使用此 SQL 获取帖子类别:

SELECT wt.* FROM wp_posts p
INNER JOIN wp_term_relationships r ON r.object_id=p.ID
INNER JOIN wp_term_taxonomy t ON t.term_taxonomy_id = r.term_taxonomy_id
INNER JOIN wp_terms wt on wt.term_id = t.term_id
WHERE p.ID=1 AND t.taxonomy="category"

关于mysql - WordPress 的 SQL : get all category of a post,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11645691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com