The iron bar is there to 'concentrate' the magnetic field created
that's by the current. That kind-of focuses the magnetism straight
under the end of the iron core, so in that small region, the magnetic
field is stronger than it would be without the core.
The magnetic field is still there without the core. It isn't as strong or
as 'focused'. So the iron filings would not be attracted as strongly,
and some of them might fly every which way, like up along the sides
of where the wire is coiled. But there's still a magnetic field there,
and iron filings are still attracted.
The reason is simply because there is always a magnetic field around
a conductor that is carrying an electric current, whether or not it's
wrapped around an iron core.