Title: WP REST API &#8211; Pure Taxonomies
Author: Andrew MAGIK
Published: <strong>12. februar, 2016</strong>
Last modified: 1. mars, 2016

---

Søk i utvidelser

Denne utvidelsen **har ikke blitt testet mot noen av de siste 3 hovedutgivelsene
av WordPress**. Den er kanskje ikke lenger holdt vedlike eller støttet, og den kan
ha kompatibilitetsproblemer med nyeste versjoner av WordPress.

![](https://s.w.org/plugins/geopattern-icon/wp-rest-api-pure-taxonomies.svg)

# WP REST API – Pure Taxonomies

 Av [Andrew MAGIK](https://profiles.wordpress.org/magikru/)

[Last ned](https://downloads.wordpress.org/plugin/wp-rest-api-pure-taxonomies.1.0.zip)

 * [Detaljer](https://nb.wordpress.org/plugins/wp-rest-api-pure-taxonomies/#description)
 * [Omtaler](https://nb.wordpress.org/plugins/wp-rest-api-pure-taxonomies/#reviews)
 *  [Installering](https://nb.wordpress.org/plugins/wp-rest-api-pure-taxonomies/#installation)
 * [Utvikling](https://nb.wordpress.org/plugins/wp-rest-api-pure-taxonomies/#developers)

 [Brukerstøtte](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/)

## Beskrivelse

Now you have no need to make additional requests to get taxonomy info (term_id, 
name, slug, term_group, term_taxonomy_id, taxonomy, description, parent, count, 
filter) from their id that is available in the default json response.

Now all available taxonomy data is available in ‘pure_taxonomies’ field from your
json response. It works for all custom added taxonomies, and for custom post types.

For example in ‘wp-json/wp/v2/posts’ you can find default fields ‘categories’, ‘
tags’ and name of custom added taxonomies that contain only its id. With this plugin
you can also find new ‘pure_taxonomies’ field that include all available ‘categories’,‘
tags’ and custom taxonomies data.

**Before:**
 { … categories: [ 3 ], tags: [ 2 ], custom_taxonomy_name: [ 1 ] … }

**After:**
 { … pure_taxonomies: { categories: [ { term_id: 3, name: «First category»,
slug: «first-category», term_group: 0, term_taxonomy_id: 3, taxonomy: «category»,
description: «», parent: 0, count: 3, filter: «raw», cat_ID: 3, category_count: 
3, category_description: «», cat_name: «First category», category_nicename: «first-
category», category_parent: 0 } ], tags: [ { term_id: 2, name: «First tag», slug:«
first-tag», term_group: 0, term_taxonomy_id: 2, taxonomy: «post_tag», description:«»,
parent: 0, count: 2, filter: «raw» } ], custom_taxonomy_name: [ { term_id: 1, name:«
Custom Taxonomy Name», slug: «custom-taxonomy-name», term_group: 0, term_taxonomy_id:
1, taxonomy: «custom_taxonomy_name», description: «», parent: 0, count: 1, filter:«
raw» } ] } … }

Check my other useful rest-api plugins: [https://wordpress.org/plugins/tags/andrew-magik-rest-api](https://wordpress.org/plugins/tags/andrew-magik-rest-api).

## Installasjon

 1. Double check you have the WordPress REST (v2) API installed and active
 2. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the
    plugin through the WordPress plugins screen directly.
 3. Activate the plugin through the ‘Plugins’ screen in WordPress

## Ofte stilte spørsmål

  How to add custom taxonomies into Rest API:

/**
 * Add REST API support to an already registered taxonomy. */ add_action( ‘init’,‘
my_custom_taxonomy_rest_support’, 25 ); function my_custom_taxonomy_rest_support(){
global $wp_taxonomies;

    ```
            //Here should be a list of names of the already created custom taxonomies:
            $taxonomy_names = array(
                'clients',
                'technologies'
            );
            foreach ( $taxonomy_names as $key => $taxonomy_name ) {
                if (isset($wp_taxonomies[$taxonomy_name])) {
                    $wp_taxonomies[$taxonomy_name]->show_in_rest = true;
                    $wp_taxonomies[$taxonomy_name]->rest_base = $taxonomy_name;
                    $wp_taxonomies[$taxonomy_name]->rest_controller_class = 'WP_REST_Terms_Controller';
                }
            }
        }
    ```

  How to add custom post type into Rest API:

/**
 * Add REST API support to an already registered post type. */ add_action( ‘
init’, ‘my_custom_post_type_rest_support’, 25 ); function my_custom_post_type_rest_support(){
global $wp_post_types;

    ```
            //Here should be a name of your already created custom post type:
            $post_type_name = 'portfolio';
            if( isset( $wp_post_types[ $post_type_name ] ) ) {
                $wp_post_types[$post_type_name]->show_in_rest = true;
                $wp_post_types[$post_type_name]->rest_base = $post_type_name;
                $wp_post_types[$post_type_name]->rest_controller_class = 'WP_REST_Posts_Controller';
            }
        }
    ```

  Do you have other useful REST-API plugins?

Yes, I have. You can check them by tag: [https://wordpress.org/plugins/tags/andrew-magik-rest-api](https://wordpress.org/plugins/tags/andrew-magik-rest-api).

## Vurderinger

![](https://secure.gravatar.com/avatar/5c64ac087df3347d1dd5fdad2f380c8c3be6d46bb04edea9ddd9c01e7d5161b0?
s=60&d=retro&r=g)

### 󠀁[Just works 🙂](https://wordpress.org/support/topic/just-works-412/)󠁿

 [dagvon](https://profiles.wordpress.org/dagvon/) 6. februar, 2018

Works right out of the box.

![](https://secure.gravatar.com/avatar/c70d7c1ea2b886428ecd4299446b65ccd86c897ea82e6f87e5ba305cc1d745f9?
s=60&d=retro&r=g)

### 󠀁[PERFECT!](https://wordpress.org/support/topic/perfect-999/)󠁿

 [Rory Michael Heaney](https://profiles.wordpress.org/rorymheaney/) 8. oktober, 
2016

Works just as described and will save you a ton of time without having to make all
those additional API calls

![](https://secure.gravatar.com/avatar/3653998f953208943beccb2fe7242201cececa4afba98e13e918c1916faa6a66?
s=60&d=retro&r=g)

### 󠀁[very helpful function](https://wordpress.org/support/topic/very-helpful-function/)󠁿

 [jarnoschi](https://profiles.wordpress.org/jarnoschi/) 3. september, 2016

to directly access taxonomy details from GET posts. thanks for the work

![](https://secure.gravatar.com/avatar/95c9f4a1ec4059d5854b7d3618048694ff0476893dcecd28457dcef7784b5a8c?
s=60&d=retro&r=g)

### 󠀁[Works Perfectly](https://wordpress.org/support/topic/works-perfectly-822/)󠁿

 [David Massiani](https://profiles.wordpress.org/david-massiani/) 3. september, 
2016

Good job!

![](https://secure.gravatar.com/avatar/c1da90711d6ac6219c1ec779788051ee00168b1ce6a970997cccc7f582eef62f?
s=60&d=retro&r=g)

### 󠀁[Very useful to reduce number of requests](https://wordpress.org/support/topic/very-useful-to-reduce-number-of-requests/)󠁿

 [Andrew MAGIK](https://profiles.wordpress.org/magikru/) 3. september, 2016

Very useful to reduce number of requests

 [ Les alle 5 vurderinger ](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/)

## Bidragsytere og utviklere

«WP REST API – Pure Taxonomies» er programvare med åpen kildekode. Følgende personer
har bidratt til denne utvidelsen:

Bidragsytere

 *   [ Andrew MAGIK ](https://profiles.wordpress.org/magikru/)

[Oversett «WP REST API – Pure Taxonomies» til ditt språk.](https://translate.wordpress.org/projects/wp-plugins/wp-rest-api-pure-taxonomies)

### Interessert i utvikling?

[Bla gjennom koden](https://plugins.trac.wordpress.org/browser/wp-rest-api-pure-taxonomies/),
sjekk ut [SVN-repositoriet](https://plugins.svn.wordpress.org/wp-rest-api-pure-taxonomies/),
eller abonner på [utviklingsloggen](https://plugins.trac.wordpress.org/log/wp-rest-api-pure-taxonomies/)
med [RSS](https://plugins.trac.wordpress.org/log/wp-rest-api-pure-taxonomies/?limit=100&mode=stop_on_copy&format=rss).

## Endringslogg

#### 1.0

 * Initial release!

## Meta

 *  Versjon **1.0**
 *  Sist oppdatert **11 år siden**
 *  Aktive installasjoner **400+**
 *  WordPress-versjon ** 4.4 eller nyere **
 *  Testet opp til **4.4.34**
 *  Språk
 * [English (US)](https://wordpress.org/plugins/wp-rest-api-pure-taxonomies/)
 * Stikkord
 * [api](https://nb.wordpress.org/plugins/tags/api/)[categories](https://nb.wordpress.org/plugins/tags/categories/)
   [rest-api](https://nb.wordpress.org/plugins/tags/rest-api/)[taxonomies](https://nb.wordpress.org/plugins/tags/taxonomies/)
   [wp-api](https://nb.wordpress.org/plugins/tags/wp-api/)
 *  [Avansert visning](https://nb.wordpress.org/plugins/wp-rest-api-pure-taxonomies/advanced/)

## Vurderinger

 5 av 5 stjerner.

 *  [  5 5-stjerne-vurderinger     ](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/?filter=5)
 *  [  0 4-stjerne-vurderinger     ](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/?filter=4)
 *  [  0 3-stjerne-vurderinger     ](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/?filter=3)
 *  [  0 2-stjerne-vurderinger     ](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/?filter=2)
 *  [  0 1-stjerne-vurderinger     ](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/?filter=1)

[Din omtale](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/#new-post)

[Se alle omtalene](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/reviews/)

## Bidragsytere

 *   [ Andrew MAGIK ](https://profiles.wordpress.org/magikru/)

## Brukerstøtte

Har du noe å si? Trenger du hjelp?

 [Vis brukerstøtteforumet](https://wordpress.org/support/plugin/wp-rest-api-pure-taxonomies/)