WordPress.org

Making WordPress.org

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#4852 closed enhancement (fixed)

Add ID to the API

Reported by: casiepa Owned by: 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
11 months ago

  • Component changed from General to WordPress.tv

#2 @dd32
11 months 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
11 months 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.