Custom post type and taxonomy with the same URL

Hi,

I’m setting up a custom post type called team with a custom taxonomy called job_titles with the same endpoint.

I would like to have an URL called team that lists all the team members, an URL team/person-name to see individual team members and an URL like team/job_title to filter team members according to their roles, e.g. team/developers.

This is my setup in frontity.settings. The Custom Post Type is working, being able to list all the team members, but the taxonomy type links, e.g. team/developers is sending back a 404 page. If I try the same link with the wordpress site directly it is working without any issues.

...
postTypes: [
            {
              type: "team",
              endpoint: "team",
              archive: "/team",
            }
          ],
          taxonomies: [
            {
              taxonomy: "job_titles",
              endpoint: "team",
              postTypeEndpoint: "team",
              params: {
                per_page: 100,
                _embed: true,
              },
            }
          ]
...

I’d suggest that in this case you create a custom handler for the pattern /team/:slug and that handler will have to do two calls to the REST API using the slug, one trying to get the team member, and if that one comes empty, another one trying to get the list of members by job title.

Maybe to get the list by job titles you even need to do two calls, one to get the job_title entity, and then use the id of the job_title to get the list.

Another way to do this might be to create a custom endpoint on your WP REST API that receives the slug and figures out if it belongs to a team member or to a job title and returns the right content. This would require only one call from Frontity to the REST API and it would provide better performance.

Hi @tibor.udvari

Could you provide a link to a repo so we can take a look at your code and clone it if necessary. Also it would be useful to see how your CPT and CT have been set up. Thanks.