Rewrite custom taxonomy slug – but only parent items

This is possible, but, the effort required is not trivial, and it is not performant, I would advise against doing it.

Your regions taxonomy will have a rewrite rule similar to this:

regions/(.+?)/?$ -> region: (.+?)

What you’re wanting is something similar to this:

(.+?)/?$ -> region(.+?)

The problem here is that this rule doesn’t catch just example.com/uk it also catches example.com/leeds example.com/about-page example.com/feed/ etc it’s too verbose.

So, there is no generic method of doing it. This means additional rules, and 2 choices, both of which will slow down the process of resolving URLs:

1: Define them all manually

This is by far the fastest method. The trade off here is time.

e.g.:

uk -> region: uk
fr -> region: fr

Or in code:

function custom_rewrite( $wp_rewrite ) {
    $feed_rules = array(
        'uk'    =>  'index.php?region=uk',
        'fr'    =>  'index.php?region=fr',
    );
    $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
}
// refresh/flush permalinks in the dashboard if this is changed in any way
add_filter( 'generate_rewrite_rules', 'custom_rewrite' );

You will need to flush permalinks when this is added/edited/removed for the URLs to work.

2: Do the above but dynamically

The problem here is that this makes the rule generation more expensive, and it gets more and more expensive as the number of terms rises. It also means you need to add a hook to the add/edit/delete hooks of that taxonomys terms so that you can flush the permalinks so they can be regenerated.

You would need to grab all the terms of the region taxonomy and loop through them, adding an appropriate entry to the array before adding to the rewrite rules.

What about the child terms?

You can either define them manually, or add a check on the loop to rewrite to regions/termnamegoeshere. You could ommit this step but WordPress may automatically redirect the browser to a longer URL name e.g. region/uk/leeds, which may or may not be to your liking.

More details on rewrite rules

You can find an answer I gave to another question with lots of links here:

Pretty URL with add_query_var

Also I recommend the Monkeyman rewrite rules for testing things during development to see exactly which rule a URL is picking up and what variables go where. You can find a link to that plugin in the answer linked above