I've a filter attached, that allows modifying an array:
$data = apply_filters( 'wpse_example_filter', $data );
The problem is, that the data can be a single or multidimensional array:
// single:
'SINGLE' => array(
// some data
)
// multidimensional:
'MULTI' => array(
0 => array(
// some data
)
1 => array(
// some data
)
)
Question: What's the easiest way to loop through the data of one of those arrays (inside my callback), without knowing if I got a single or multidimensional array and without creating another callback function?
In other words: How would I write a recursive filter callback?
SINGLE/MULTI) is what is inside$data. I'm then writing another plugin to modify the$data, array by array - or just a single one.