title: Wordpress API: How do I get the category names by ID in VueJS?
body: <p>I'm working on a small VueJS app that pulls in a list of blog posts using the Wordpress API. The categories are just IDs in the json, and I'd like to use the actual category names. For the example I'm using <a href="https://techcrunch.com/wp-json/wp/v2/posts?per_page=5&amp;_embed" rel="nofollow noreferrer">https://techcrunch.com/wp-json/wp/v2/posts?per_page=5&amp;_embed</a> for the json feed. Sample code is here: <a href="https://jsfiddle.net/richbachman/oa1L1aqm/" rel="nofollow noreferrer">https://jsfiddle.net/richbachman/oa1L1aqm/</a></p>
  
  <pre><code>var app = new Vue ({
  el: "#wp-app",
  data: function() {
      return {
          searchQuery: '',
          sources: [
              {
                  name: 'TechCrunch',
                  url: '//techcrunch.com/wp-json/wp/v2/posts?per_page=5&amp;_embed',
                  posts: []
              }
          ]
      }
  },
  
  filters: {
      niceDate: function(value) {
          if(!value) return '';
          var date = moment.utc(value);
          return date.format('MMM DD, YYYY');
      }
  },
  
  methods: {
      getPosts: function(){
      var self = this;
      self.sources.forEach(function(source, index){
        self.$delete(source, 'posts');
              var searchUrl = self.generateUrl(source);   
              self.$http.get(searchUrl).then(function(response)  {
                  self.$set(source, 'posts', response.data);
              }, function(response) {
                  console.log('Error');
              })
      });
    },
  
    generateUrl: function(source) {
      var self = this;
      if(self.searchQuery) {
          return source.url + '&amp;search=' + encodeURI(self.searchQuery);
      } else {
          return source.url;
      }
    }
  },
  
  mounted: function(){
      this.$nextTick(function(){
          this.getPosts();
      });
  }
  });
  </code></pre>
  
  <p>Using the above code, I'm able to pull in an array of category IDs using:</p>
  
  <pre><code>{{post.categories}}
  </code></pre>
  
  <p>Just not sure how to translate those IDs to actual category names. Thanks in advance for any help.</p>