There are several reasons behind restricting certain posts or categories by country. If the post or page or category is not relevant to people in certain countries, you expect to see little or no traffic from those places or the text can confuse innocent people. In such cases, many website administrators decide to block countries in WordPress by IP, so that they can safeguard their visitors from harm. It also safeguards the website from malicious attempts or even from Governmental ban.
Use Some Plugin Can Block a Defined Country as a Security Feature
There was a great free WordPress plugin named Geo IP Block.
Unfortunately, it has not been updated and now stops working if you use PHP 8.x. If you are an older version of WordPress with PHP 7.x, then it will work (using an older version of WordPress not be suggested as may open security loopholes). However, it is very easy to block a category by using this plugin. Just visit the settings page, go to “Front-end target settings”, enable “Block by country”, set the matching rule as Matching rule, add the category you want to block, and add the country code you want to block. You can set custom text for the blocked visitors.
Save the settings. The result will be like this when browsed from a blocked country:
It is great but the plugin does not work with the latest PHP as we have mentioned above. You need an alternative plugin or method which works.
iQ Block Country is a similar plugin:
However, it does not work as IP Geo Block does. Next, you have three popular options – WordFence, GeoTargeting Lite and MalCare. All of these plugins are available on the WordPress Plugin repository. All of them will need the premium versions to get all the features.
So these are your options. I think with a limited budget, for testing purposes, you can use the old version of PHP and WordPress to get IP Geo Block plugin working.