I am querying a WP DB to get the following:
userid
collection_name
collection_data (serialized array)
I run the following foreach loop:
foreach($result as $row){
$row->collection_name;
$cleandata = unserialize($row->collection_data);
The print_r of $cleandata gives me the following arrays:
Array
(
[7] => Array
(
[ExerciseID] => 7
[Description] => Description?!
[Sets] => 12
[Reps] => 12
[Load] => 12
[Rest] => 12
[Tempo] => 12
)
)
From this I need to create an array of ExerciseID’s so I can put them into the following WP_query.
$the_query = new WP_Query(array('post__in' => $ids, 'post_type' => 'exercise','posts_per_page' =>'4000')); ?>
I have tried running another foreach within the foreach $result as $row
however I am getting pretty stuck with it.
Many thanks in advance.
If you don’t have PHP >= 5.5 and so can’t use array_column(), then use
Try this-