Thanks to the help of the link provided by @q-studio I was able to determine the correct course of action.
Firstly I setup an action to load the code in the init
using the ‘init’ tags in an add_action();
within my functions.php file.
add_action( 'init', 'wpteaminfo_init' );
Then i created the function to setup my id variable with add_rewrite_tag();
then I added a rewrite rule with add_rewrite_rule();
function wpteaminfo_init()
{
add_rewrite_tag('%id%','([^&]+)');
add_rewrite_rule('^team-info/([0-9]{1,})/?','index.php?page_id=735&id=$matches[1]','top');
}
Finally on my page due to using a php snippet to get and style the json data I had to create a variable from the final part of the url.
this was accomplished by using get_query_var();
and putting the variable name within the brackets.
In my case i set the code up using this
$requestid = get_query_var( 'id' );
then the result was by having the url as so url/team-info/123/
it was returning the id which in this case is 123, sending it to the webpage in a usable variable $requestid
.
I hope this helps anyone who finds it.
-Adam