There are a number of ways to add Google Analytics 4 to your WordPress-based website, and the good news is that these approaches are very much the same as the approaches we already use to add GA3/Universal Analytics.
Regardless of how you add Google Analytics 4 to your WordPress-based website, you still need to setup and configure a Google Analytics 4 account. Once you've setup and configured your GA4 account, you can go ahead and select one of these three methods to add the GA4 code to your website.
Our preferred method (and what we think is the easiest and cleanest approach) is to install GA4 with Google Tag Manger. We've completed dozens upon dozens of GA4 migrations and we've become so good at it that we developed our own training for other people who want to install GA4 via GTM (individuals and agencies). We show you how to setup and install Google Tag Manager on WordPress, how to setup and properly install your new GA4 account, and how to connect GA4 to GTM.
Another approach is to install GA4 with a plugin. The advantage of this approach is that it's very easy to do, and often all you have to provide is your GA4 Measurement ID. Note that the UA- ID is what was used for UA/GA3, and the new Measurement ID is what's used for GA4.
A third approach is to add the code by hand. You can grab the code and add it to your website but this is a bit more complex than it was in the past where you just had to add your UA script, so I'd recommend you go with one of the two options above.
As we've seen, there are a few ways to add GA4 to your WordPress-based website, and the good news is that there's nothing special you need to do per se as it's just like adding any other tracking to your website.