Website filtering is a great way to protect users of a WiFi router by limiting where they can go on the internet.
Hackers can still work around this by compromising the DNS used by the WiFi router or by compromising the allowed sites. But this requires very sophisticated hacking techniques in order to achieve.
Website filtering can either restrict users to a given set of websites or restrict them from accessing a given set of sites. Since a lot of malware comes from compromised or malware websites, limiting access to only those sites that are known to be valid can mitigate infection risk, and can also help stop propagating malware if a device does get infected.
A number of WiFi routers offer the ability to allow or deny access to specific websites/domains. This is a firewall function. While most WiFi routers don’t provide a big list of sites, this can be a very useful feature for limiting access to well-known and trusted sites, or blocking access to well-known illicit or illegal sites.