Wireless networked control systems (WNCS) consist of an actuator, sensor, and controller communicating over wireless networks in place of traditional point-to-point wired connection. Due to their main advantages, a decrease in maintenance costs, more flexibility, and safety could be achieved. As a result, it attracted a great deal of interest, but packet losses and time delays in the wireless network through transmitting and receiving the data are considered very challenging issues, which impair the output accuracy of the WNCS and can affect the entire system stability. In this study, integer-order proportional integral-proportional derivative (PI-PD) and fractional-order PI-PD (FOPI-FOPD) controllers are proposed to reduce the effect of expected packet loss in a WNCS to improve system performance. At high packet loss percent, the PI controller is introduced to act as a compensator in the feed-forward loop to keep the system stable. MATLAB/Simulink and Truetime simulator are used to simulate the WNCS. The rotary inverted pendulum (RIP) is utilized as the object of the controllers. Grey wolf optimization (GWO) algorithm is used to find the optimal controllers and compensator parameters. The simulation results showed that the FOPI-FOPD is superior to PI-PD in the packet loss compensation.