2 Grammaly and style changes.
source | link

Get How to get categories with posts by custom field value?

I have a big categories tree (~2000 total, around 2000 subcategories)... And, and I have a lot of posts with a custom field "city"city (different values). I

I have created filter posts by "city" field. But I have a problem with categories list. I just need to show all categories that have 1+ posts with needed value in "city"the city field. If I'll

If I get all categories in an array and check the number of posts by the custom field in each category in a loop - therethat will create thousands dbof DB queries. Than I need a more accurate solution to do this...

Get categories with posts by custom field value

I have a big categories tree (~2000 total subcategories)... And I have a lot of posts with custom field "city" (different values). I have created filter posts by "city" field. But I have problem with categories list. I just need to show all categories that have 1+ posts with needed value in "city" field. If I'll get all categories in array and check number of posts by custom field in each category in loop - there will create thousands db queries. Than I need a more accurate solution to do this...

How to get categories with posts by custom field value?

I have a big categories tree, around 2000 subcategories, and I have a lot of posts with a custom field city (different values).

I have created filter posts by "city" field. But I have a problem with categories list. I just need to show all categories that have 1+ posts with needed value in the city field.

If I get all categories in an array and check the number of posts by the custom field in each category in a loop - that will create thousands of DB queries. I need a more accurate solution to do this.

1
source | link

Get categories with posts by custom field value

I have a big categories tree (~2000 total subcategories)... And I have a lot of posts with custom field "city" (different values). I have created filter posts by "city" field. But I have problem with categories list. I just need to show all categories that have 1+ posts with needed value in "city" field. If I'll get all categories in array and check number of posts by custom field in each category in loop - there will create thousands db queries. Than I need a more accurate solution to do this...