Place this function in your theme’s functions.php:
function has_get_request_value($name, $value) {
return isset( $_GET[$name] ) && $_GET[$name] === $value;
}
In the Visibility field:
has_get_request_value('state', 'TAS') || has_get_request_value('state', VIC') || has_get_request_value('state', 'WA')
Brilliant! Thanks Jonathan.
Anytime!
Please let me know if there is anything else I can help you with!
BTW, we are always looking for feedback; if you have a moment, please let us know how we are doing by leaving us a review!
Thanks!
Jon
Thanks. Have added a review and feedback.
If I wanted to reverse that function and hide from multiple states, I thought this should work but it doesn’t.
function hide_from_states($name, $value) {
return isset( $_GET[$name] ) && $_GET[$name] != $value;
}
Thanks for the feedback!
Wrap everything in parentheses with an exclamation point before it.
For example:
!(has_get_request_value('state', 'TAS') || has_get_request_value('state', VIC') || has_get_request_value('state', 'WA'))
meaning, not any of the three specified.