Earth's magnetic field is distorted, compressed on the side facing the Sun, greatly extended on the opposite side. The reason for this is the solar wind , a particle flux from the sun, consisting mostly of protons and electrons. Note that the Van Allen belts act as a magnetic mirror to trap high energy particles and direct them to the pole regions. When they interact with the upper atmosphere you get aurora . The mapping of the magnetic field around Earth, and the discovery of the Van Allen belts were the first important landmarks of scientific space exploration through spacecraft in the 1950s.
Ionization means many free electrons in the core.
By the dynamo effect , a changing electric field produces a magnetic field.