Time-delayed control has shown effectiveness in vibration mitigation of flexible beams. Yet, classical time-delayed controllers are not suitable for unknown excitation frequencies and higher-order vibrations due to their lack of adaptive adjustment for the optimal time delay. In this paper, a method based on time-delayed control is proposed for planning boundary motion to mitigate vibrations of flexible beams, which is applicable for unknown external excitation frequencies, and is also effective for higher-order vibration mitigation. The theoretical model is developed using the Lagrange equations derived from the Euler-Bernoulli beam theory, which takes into account the geometrical nonlinearity of flexible beams. It is found that the effect of boundary motion on the vibration of the flexible beam shows a harmonic relationship with the time delay and a linear correlation with the gain in the control algorithm by analyzing the variation of the system's energy. The optimal time delay is determined based on the instantaneous frequency, which is identified using the short-time Fourier transform. Furthermore, the optimal time delay is also dependent on the resonance order and switches between two values accordingly. To this end, a bang-bang algorithm is employed to adaptively adjust the time delay. Both theoretical and experimental results confirm the effectiveness of the proposed method in mitigating flexible beam vibrations. The method exhibits robustness against random disturbances affecting the system.