If you unplugged your Wi-Fi router, that wouldn't damage the power cord - you should be able to simply plug it back in and everything should work normally after a few minutes for the router to boot up.
Yes, you can replace it if it's loose or damaged. Find the model number on your router or modem. Search online.
I shall suggest you to try the following:
Turn off the printer.
Unplug the router/modem for 30 seconds, then plug it back in.
Wait 2–3 minutes for Wi-Fi to fully restore.
Turn the printer back on.
Wait another minute to let it reconnect.
Try printing a test page.