Skip to content

Instantly share code, notes, and snippets.

@scottopolis
Created October 27, 2015 22:27
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save scottopolis/997b86d8afa7825bc942 to your computer and use it in GitHub Desktop.
Save scottopolis/997b86d8afa7825bc942 to your computer and use it in GitHub Desktop.
Add custom taxonomies to the WP-API
<?php
function ms_add_tax_to_api() {
$taxonomies = get_taxonomies( '', 'objects' );
foreach( $taxonomies as $taxonomy ) {
$taxonomy->show_in_rest = true;
}
}
add_action( 'init', 'ms_add_tax_to_api', 30 );
@shprink
Copy link

shprink commented Oct 29, 2015

it works ;) thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment