Resource allocation plays a pivotal role in improving the performance of wireless and communication networks. However, the optimization of resource allocation is typically formulated as a mixed-integer non-linear programming (MINLP) problem, which is non-convex and NP-hard by nature. Usually, solving such a problem is challenging and requires specific methods due to the major shortcomings of the traditional approaches, such as exponential computation complexity of global optimization, no performance optimality guarantee of heuristic schemes, and large training time and generating a standard dataset of machine learning based approaches. Whale optimization algorithm (WOA) has recently gained the attention of the research community as an efficient method to solve a variety of optimization problems. As an alternative to the existing methods, our main goal in this article is to study the applicability of WOA to solve resource allocation problems in wireless networks. First, we present the fundamental backgrounds and the binary version of the WOA as well as introducing a penalty method to handle optimization constraints. Then, we demonstrate three examples of WOA to resource allocation in wireless networks, including power allocation for energy-and-spectral efficiency tradeoff in wireless interference networks, power allocation for secure throughput maximization, and mobile edge computation offloading. Lastly, we present the adoption of WOA to solve a variety of potential resource allocation problems in 5G wireless networks and beyond.