Plugin Author
Brian
(@brianmiyaji)
@alextemina
Thanks for your question! I think I can help with this.
Any of the custom post types in SportsPress can be filtered by using the taxonomy name and term slug. In this case, try:
sportspress/v2/teams?filter[sp_league]=primary-league
Where “primary-league” is the competition slug. Let me know if that works 🙂
oh my god, finally, I love you. I was trying with the ID. for weeks.
I’ll assume this works with the rest of filters, like players from a certain things and such.
Thanks!
ok, I found a dead end again. I need to know how to filter players by their team… if I get all players it takes years to load.
Plugin Author
Brian
(@brianmiyaji)
@alextemina Glad to hear that! Looks like we need to enable meta query vars to filter by team. This will be in the next update. To start using it now, add these lines to includes/api/class-sp-rest-api.php: View on GitHub
Once the meta query vars is enabled, you can use the meta_key and meta_value filters together, like this:
sportspress/v2/players?filter[sp_league]=primary-league&filter[meta_key]=sp_team&filter[meta_value]=123
Where 123 is the team’s ID.
Hope that helps!
You saved my life again. If we ever meet in life, all drinks, on me.
Thanks!