Your server/hosting must have protection against DDoS attacks.
We can't technically implement protection from within the CMS (sсript), so protection must be implemented at the server level.
We recommend using servers from companies that provide DDoS protection for their clients, such as DDOS-GUARD and others.
In some cases, we can recommend services like Cloudflare. These services protect your domain, but they don't protect your website infrastructure.
A common mistake: order protection from Cloudflare, then specify the IP address of an unprotected server in the SPF records in DNS. This way, an attacker will learn your real IP address and bypass the protection.