PHP array_filter trim is not working as callback May 31, 2016May 31, 2016 / WordPress Mechanic / 1 Comment PHP array_filter trim is not working as callback Have you tried this? $arr = array_filter($arr, 'trim'); Solution: $arr = array_filter(array_map('trim', $arr)); PHP array_filter trim is not working as callback