For anyone new to this topic, if you find yourself with a Play:5 gen2 or other Sonos speaker that can't connect to the network when wireless, but it works just fine wired in, there are a number of things to check, but there's a chance that there's something wrong with the wireless on the device. Run a diagnostic in the Sonos app with the speaker connected to the network using an Ethernet cable. This is under Settings > Advanced Settings.
With the diagnostic number handy, the best thing to do is to
get in contact with our support team directly. They will help identify if there's a hardware issue or something network related that can be fixed, and will assist with the next steps.
Mark good posts by pressing the like button, and select the best answer on questions you've asked to help others find solutions.