I want to retrieve all products in side a subcategory . this is the code I've :
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)
the problem is , this code return about 20 products but when I go to that category in website ,it returns about 40 products.
could you help me ? I need a code to return a list of products inside a category .
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) LIMIT 0,15000000
Use Limit keyword in your mysql query.
Limit accepts start and end value.
if you are giving Limit 5
it will display only top 5 records. If you are giving Limit 5,10
it will display records between 5-10. If you are giving Limit 0,big number (eg. Limit 0,100000000
) it will display all the records upto 100000000.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.