Creating a custom rewrite for a single page

Question

I am quite new to working within wordpress but am getting along quite smoothly.

I have setup a website where its downloading external JSON data from rapid-api and then displaying them in my design. The data is about Football/Soccer teams.

I have setup a page that is url/team-info/?id=123

In here its fetching the id from the url and downloading that specific teams information from the json.

That all works perfectly, but I am having to use a PHP snippet plugin in order for it to work.

I then wanted to create a rewrite rule to change it from url/team-info/?id=123 to url/team-info/123

I originally tried editing the htaccess file directly but that threw up all sorts of 500 errors, so I put the original back and left it as it was.

I then have seen lots of posts about adding in code like so into the ‘init hook’, something I am not familiar with in wordpress, back to 2013 and 2014, I am sure these will be out dated so am looking for guidance.

So far I have learned the page in question is /?page_id=735 which then ?page_id=735&id=123 also works.

I look forward to your guidance on this matter and if you have any furtur questions please let me know.

0
Chalkie 2 years 2020-12-29T03:10:20-05:00 0 Answers 3 views 0

Leave an answer

Browse
Browse