I want to build a plugin that makes an AJAX request to a third party API that responds with a JSON that looks abstractly like this:

{ show1 : [ season1: [ {episode1}, {episode2}, {episode3} ], season2: [ {episode1}, {episode2} ] ] }

So that I would set up a page in Wordpress for the show that exists at : site/show1

On on that page I could have links from each listed episode that goes to a url like this: site/show1/season1-episode1 without actually having to build a page or post in Wordpress for every episode.

Is this even possible and if so, any ideas on how one might go about accomplishing this?


What you want is very simple but also takes a lot of work to make it work as you expected.

The first start will be to create a base page. This page will be responsible for all of the requests.

For example :


Now you want to tell WP how to handle this kind of urls https://developer.wordpress.org/reference/functions/add_rewrite_rule/

example code


But somehow you need to tell WP to understand these new parameters (showname and episodeseason )

add_filter( 'query_vars', 'set_videogalerie_query_vars' );
function set_videogalerie_query_vars( $vars ) {
    $vars[] = 'showname';
    $vars[] = 'episodeseason';

    return $vars;

Now you can do what you want on the template of the videogalerie page. You can make a request to the third party API retrieve the data you want and parse them before loading the page.

The Ajax part not sure why you need it as this way the server can load the full list of url Shows and Seasons before showing to the user. But if you want that this can be handled by this answer wordpress.stackexchange.com

Have fun!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.