As a workaround you can try one of the following which will redirect for “rejected” countries. N.B. the page title may appear for a flash before the browser redirects. To test if it works just swap your own country code in and out of the short code
[cca_display only=US,CA]<script>window.location = "https://example.com";</script>[/cca_display]
text content (NOT for USA and Canada) here
.....
.....
or
[cca_display not=US,CA]<script>window.location = "https://example.com";</script>[/cca_display]
text content (ONLY for USA and Canada) here
.....
.....
The [cca_display] shortcode with its javascript should be above your content.
Make sure the post editor is in Text mode (NOT Display) when you add the shortcode javascript. Change the exmple.com in above to the URL you want the page redirected e.g. your sites home page or a custom 404 not found page.
I am considering writing a proper solution (on my own site I already have code to prevent listing of selected posts on the home page). The workaround above isn’t perfect: if your home page lists your posts they will still be listed for ALL visitors (but when a user from the specified country clicks the link on your homepage he will be redirected). Even worse if your home page displays every post in full (instead of excerpts) then I even visiting the home page might cause a redirect for the specified countries.
Last time I checked Google crawlers were US based, if you hide a post from US visitors it won’t be indexed by Google.
-
This reply was modified 8 years, 2 months ago by wrigs1.
-
This reply was modified 8 years, 2 months ago by wrigs1.
-
This reply was modified 8 years, 2 months ago by wrigs1.
-
This reply was modified 8 years, 2 months ago by wrigs1.
-
This reply was modified 8 years, 2 months ago by wrigs1.