function.php flatten function redefined