Skip to content

Instantly share code, notes, and snippets.

Last active May 21, 2018 18:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
var WPAPI = require( 'wpapi' );
var RSVP = require('rsvp');
// Using the RSVP.hash utility for convenience and parallelism
categories: wp.categories().slug( 'it-services' ),
tags1: wp.tags().slug('hotel-name'),
tags2: wp.tags().slug('march-events')
}).then(function( results ) {
// Combine & map .slug() results into arrays of IDs by taxonomy
var tagIDs = results.tags1.concat( results.tags2 )
.map(function( tag ) { return; });
var categoryIDs = results.categories
.map(function( cat ) { return; });
return wp.posts()
.tags( tags )
.categories( categories );
}).then(function( posts ) {
// These posts are all fiction, either magical realism or historical:
console.log( posts );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment