Append taxonomy url

You have at least 3 ways of accomplishing this.

Option 1

The easiest is to change your permalink structure to “Post Name”, and then create your landing pages with the slugs you want. So, your slug for york would be “trainers-in-york”.

Option 2

If you absolutely must modify the url, you can use add_rewrite_rule to accomplish that. Place this in functions.php (or a plugin file)

<?php
// Create taxonomy endpoint
function taxonomy_endpoint()
{
        // Add the rewrite rule.
        add_rewrite_rule('^(trainers-in-[a-zA-Z-]{2,})/?', 'town/$matches[2]', 'top');
}
add_action( 'init', 'taxonomy_endpoint' );

The rewritten url above (beginning with “town”) is just an example. You would have to change that to whatever url you wanted the user directed to. $matches[2] would be filled in with the location your user supplied. For example: example.com/trainers-in-york would be changed to example.com/town/york

Option 3

If you need to do something more complicated, like change the $wp_query based on the url, you can do that with rewrite tags and the pre_get_posts action.

// Create taxonomy endpoint
function taxonomy_endpoint()
{
        // Add variables to populate from the url
        add_rewrite_tag('%my_taxonomy%', '([a-zA-Z-]{2,})' );

        // Add the rewrite rule. This sets the "my_taxonomy" variables 
        add_rewrite_rule('^(trainers-in-[a-zA-Z-]{2,})/?', 'index.php?my_taxonomy=$matches[2]', 'top');
}
// Hook into init, so this is done early
add_action( 'init', 'taxonomy_endpoint' ); 

// Checks if our "my_taxonomy" variable is set, and modifies the wp_query if it is
function taxonomy_redirect()
{
        global $wp_query, $wpdb;

        // If not the main query, don't change anything.
        if ( !$query->is_main_query() )
                return;

        // Get our variables
        $taxonomy = $wp_query->get('my_taxonomy');

        // If my_taxonomy is NOT set, then continue on without changing anything
        if (!$taxonomy)
                return;

        // Put your code to do something to the post here... 
        // For example... This sets the page_id to 10. 
        $query->set('page_id',10);

        // Realistically, you would fill this part with get_post() or
        // wpdb->get_results or some other logic to select data 
        // to change the query
}
// Hook into pre_get_posts, so this runs before the post data is retrieved
add_action( 'pre_get_posts', 'taxonomy_redirect' );

Good luck!