Check request URL for pattern

how’s the URL structure? Could you paste here?

If you’re URL follows this structure: http://example.com/?foo=bar, so you need to get the foo value with this:

if ( isset( $_GET['foo'] ) ) {
   $bar_value = $_GET['foo'];
   // Do whatever you want with $bar_value.
} else {
  // Do something else.
}

If that doesn’t work, you could test get_query_var()function, here is the link. This should work like the code below in a simple way.

Tell me if any of this worked for you.