On most Whirlpool ranges, the oven door will only lock when the unit is in the self clean mode. It will remain locked until the oven is cooled down. If you were using this feature, wait until the oven cools down before trying to open the oven door.
You can cancel the self clean feature on most ranges by pressing the OFF/CANCEL button. As noted above, the oven door will remain locked until the oven cools even after this cleaning feature is canceled.
If the oven door will not unlock properly after the self clean cycle is completed (or canceled) and the oven has already cooled, then you likely have a component failure in the oven door lock, the temperature sensor or the oven electronic control board. A technician is normally needed to diagnose and repair this type of failure.
If you need more help, resubmit your question with additional details and the full model number of your Whirlpool range. The model number on some Whirlpool ranges is located on a plate in on the frame just in front of the left or right front leveling leg. You can check for this plate by pulling out the bottom drawer.