Making WordPress.org

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4852 closed enhancement (fixed)

Add ID to the API

Reported by: casiepa's profile casiepa Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: WordPress.tv Keywords:
Cc:

Description

Please add also the ID of the taxonomy/category so it could be used by external tools to submit a video to WordPress.tv (e.g. the submit-video form needs the category IDs for WordCampTV, Europe, 2019)

The code to be changed is in /themes/wptv2/plugins/wordpresstv-rest/wordpresstv-rest.php

Change

foreach ( $terms as $t ) {
  $item = array(
      'name' => $t->name,
      'link' => get_term_link( $t ),
      'api'  => add_query_arg( $taxonomy_obj->query_var, $t->slug, home_url( '/api/videos.json') ),
      'videos' => $t->count,
  );

to

foreach ( $terms as $t ) {
  $item = array(
      'id'   => $t->term_id,
      'name' => $t->name,
      'link' => get_term_link( $t ),
      'api'  => add_query_arg( $taxonomy_obj->query_var, $t->slug, home_url( '/api/videos.json') ),
      'videos' => $t->count,
  );

Change History (3)

#1 @casiepa
5 years ago

  • Component changed from General to WordPress.tv

#2 @dd32
5 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 9286:

WordPress.TV: Add the Term ID to the API response.

Props casiepa.
Fixes #4852.

#3 @dd32
5 years ago

For some things like this, the WordPress Rest API is probably a better option: https://public-api.wordpress.com/rest/v1.1/sites/wordpress.tv/categories

Added it either way. Deployed now.

Note: See TracTickets for help on using tickets.