I'm certain this is VERY simple, but being new and not knowing what I'm doing I can't quite get it on my own.
I am trying to create an array of wordpress post ID's that is derived from a simple foreach loop.
Basically I have this as my code:
$omit_these_quizzes = array();
foreach ( $filtered_pass as $single_quiz ) {
$quiz_id_number = $single_quiz['quiz'];
$omit_these_quizzes[] = $quiz_id_number;
}
I would like to take each of the resulting $quiz_id_number 's and have then end up in array that looks like this:
$omit_these_quizzes = array(8195,8193);
However, I keep ending up with an array that only contains the variable from the very last foreach loop, instead of them all. What am I doing wrong?
Thanks!
$filtered_passcontains only one id, or the result in$omit_these_quizzesis okay, but you inspect/process it in the wrong way.