Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
this.$el.find( '.taxonomy-terms' ).select2({
multiple: true,
ajax: {
url: WP_API_Settings.root + 'wp/v2/terms/' + this.options.taxonomy.slug,
data: function( term, page ) {
return {
search: term,
page: page,
_envelope: true
}
},
results: function( data, page ) {
return {
results: data.body.map( function( term ) {
return { text: term.name, id: term.id };
} ),
more: data.headers['X-WP-TotalPages'] > page
}
}
},
width: '100%'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.