我想检索子类别中的所有产品。这是我的代码:
SELECT * from `wp_term_relationships` where term_taxonomy_id=$subcatId and
object_id in(select ID from `wp_posts` where `post_type`='product' and post_status='publish' and ID=wp_term_relationships.object_id)
问题是,这段代码返回了大约 20 个产品,但是当我在网站上转到该类别时,它返回了大约 40 个产品。
你可以帮帮我吗 ?我需要一个代码来返回一个类别中的产品列表。