I have the following multidimensional array stored in a variable named posts
{ID: 141, categories: ["candy", "fruits", "vegetables"]}
{ID: 142, categories: ["fruits"]}
{ID: 143, categories: ["candy", "vegetables"]}
Is it possible to create a new array only with items containing candy in the categories?
So the new posts variable will have the following array:
{ID: 141, categories: ["candy", "fruits", "vegetables"]}
{ID: 143, categories: ["candy", "vegetables"]}