Just remember that WD-40 is a
Water
Dispersing penetrant that is only about 10% light oil that will wash out with any future rain and wash water. The stuff has it's place and is frequently used as a first flush in flood vehicles (ugly trick of the salvage trade).
The WD-40 downside was seen in a series of airplane rod end bearings destroyed at a single operator because their mechanics were using WD-40 to clean "and lube" the sealed rod-ends. The penetrant was able to get past the seals to dissolve and flow out the petroleum, so some balls in the bearings wore to the point they were no longer round. The airplanes at that small Caribbean airline were unique in having this failure before the company was bought out.
A photo from that lives on at WbW and is linked below. Note the scarring on the ball in this sectioned bearing and the rusty surface of the outer race. The race's path for the balls is worn from the original spherical shape. (right edge of the photo)
WD-40 is also very hard on plastics, slowly hardening the surface with each application.
In other words, while WD-40 or similar would be a great trick to free up the shifter in the short term, make SURE to take it apart, clean, and grease it as soon as possible.
btw - This isn't meant to start a pro/con WD-40 thread, and there are people who swear by it as the cure for everything. Kinda like Windex in the movie "Big Fat Greek Wedding.
I'm just trying to give reason to not rely on a penetrating light oil for long term use in the shift mechanism or anywhere else that a real grease is needed. For example, I see it used on rear suspension links and would not recommend it. Use on chains is an entire endless recurring topic of its' own for another time and place.