WP REST API taxonomy is missing on custom post type

admin2025-01-07  3

i use wp-rest-api v2 plugin. Custom post types doesnt show taxonomy. somebody can tell me whats wrong?

URL: /wp-json/wp/v2/galeri?_embed

{
"id": 275,
"date": "2016-05-07T23:53:17",
"date_gmt": "2016-05-07T20:53:17",
"guid": {
    "rendered": "http:\/\/demo.markamiz\/?post_type=galeri&p=275"
},
"modified": "2017-07-21T15:07:24",
"modified_gmt": "2017-07-21T12:07:24",
"slug": "samsung-galaxy-s7-edge",
"status": "publish",
"type": "galeri",
"link": "http:\/\/www.teknoever\/galeri\/samsung-galaxy-s7-edge\/",
"title": {
    "rendered": "Samsung Galaxy S7 Edge"
},
"content": {
    "rendered": "<p>Toplam <b>7<\/b> sayfadan <b>1.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-276\" src=\"http:\/\/demo.markamiz\/wp-content\/uploads\/2016\/05\/150604_samsung-galaxy-s7-1445005423.jpg\" alt=\"150604_samsung-galaxy-s7-1445005423\" width=\"580\" height=\"356\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>2.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-277\" src=\"http:\/\/demo.markamiz\/wp-content\/uploads\/2016\/05\/150604_samsung-galaxy-s7-edge-concept-renders.jpg\" alt=\"150604_samsung-galaxy-s7-edge-concept-renders\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>3.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-278\" src=\"http:\/\/demo.markamiz\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-1.jpg\" alt=\"150605_samsung-galaxy-s7-edge-concept-renders-1\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>4.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-279\" src=\"http:\/\/demo.markamiz\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg\" alt=\"150605_samsung-galaxy-s7-edge-concept-renders-2\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>5.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-280\" src=\"http:\/\/demo.markamiz\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-3-1445005456.jpg\" alt=\"150605_samsung-galaxy-s7-edge-concept-renders-3-1445005456\" width=\"580\" height=\"385\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>6.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-281\" src=\"http:\/\/demo.markamiz\/wp-content\/uploads\/2016\/05\/150606_samsung-galaxy-s7-edge-concept-renders-4.jpg\" alt=\"150606_samsung-galaxy-s7-edge-concept-renders-4\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>7.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-282\" src=\"http:\/\/demo.markamiz\/wp-content\/uploads\/2016\/05\/150606_samsung-galaxy-s7-edge-concept-renders-5-1.jpg\" alt=\"150606_samsung-galaxy-s7-edge-concept-renders-5\" width=\"580\" height=\"386\" \/><\/p>\n",
    "protected": false
},
"excerpt": {
    "rendered": "<p>Y\u0131l\u0131n en dikkat \u00e7ekici modellerinden bir tanesi olan Samsung Galaxy S7 edge, inceleme merkezimizin yeni konu\u011fu oluyor.<br \/>\nSamsung, ge\u00e7ti\u011fimiz y\u0131l sat\u0131\u015fa sundu\u011fu Galaxy S6 ve Galaxy S6 edge modelleriyle tasar\u0131m dilinde ciddi bir de\u011fi\u015fikli\u011fe gitmi\u015f, plastik tasar\u0131m\u0131 tarihin tozlu sayfalar\u0131nda b\u0131rakarak cam ve metal malzemelerle haz\u0131rlanan premium tasar\u0131mlar\u0131 bizlere sunmu\u015ftu. \u00d6zellikle S6 edge ve daha sonra sat\u0131\u015fa sunulan S6 edge+, y\u0131l\u0131n en \u015f\u0131k modelleri aras\u0131nda g\u00f6sterilmi\u015fti.<\/p>\n",
    "protected": false
},
"author": 4,
"featured_media": 7825,
"menu_order": 0,
"comment_status": "open",
"ping_status": "open",
"template": "",
"meta": [],
"acf": [],
"_links": {
    "self": [{
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/galeri\/275"
    }],
    "collection": [{
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/galeri"
    }],
    "about": [{
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/types\/galeri"
    }],
    "author": [{
        "embeddable": true,
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/users\/4"
    }],
    "replies": [{
        "embeddable": true,
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/comments?post=275"
    }],
    "version-history": [{
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/galeri\/275\/revisions"
    }],
    "wp:featuredmedia": [{
        "embeddable": true,
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/media\/7825"
    }],
    "wp:attachment": [{
        "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/media?parent=275"
    }],
    "curies": [{
        "name": "wp",
        "href": "https:\/\/api.w\/{rel}",
        "templated": true
    }]
},
"_embedded": {
    "author": [{
        "id": 4,
        "name": "Erdin\u00e7",
        "url": "http:\/\/www.teknoever",
        "description": "Uzun y\u0131llar bir\u00e7ok blog ve haber portallar\u0131nda edit\u00f6r olarak \u00e7al\u0131\u015fmas\u0131n\u0131n yan\u0131nda, asp ve php yaz\u0131l\u0131mlar\u0131na olduk\u00e7a hakim ve bir\u00e7ok projede b\u00fcy\u00fck ba\u015far\u0131lara imza atm\u0131\u015ft\u0131r. Edit\u00f6rl\u00fck kariyerinde \u015fimdi Tekno Ever ile devam etmektedir.Referanslar i\u00e7in l\u00fctfen markamiz'u ziyaret ediniz.",
        "link": "http:\/\/www.teknoever\/yazar\/erdinc\/",
        "slug": "erdinc",
        "avatar_urls": {
            "24": "http:\/\/2.gravatar\/avatar\/b37cac9cdbbc2f7cdae3348e514a305b?s=24&d=mm&r=g",
            "48": "http:\/\/2.gravatar\/avatar\/b37cac9cdbbc2f7cdae3348e514a305b?s=48&d=mm&r=g",
            "96": "http:\/\/2.gravatar\/avatar\/b37cac9cdbbc2f7cdae3348e514a305b?s=96&d=mm&r=g"
        },
        "acf": [],
        "_links": {
            "self": [{
                "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/users\/4"
            }],
            "collection": [{
                "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/users"
            }]
        }
    }],
    "wp:featuredmedia": [{
        "id": 7825,
        "date": "2016-09-06T17:31:52",
        "slug": "150605_samsung-galaxy-s7-edge-concept-renders-2",
        "type": "attachment",
        "link": "http:\/\/www.teknoever\/galeri\/samsung-galaxy-s7-edge\/150605_samsung-galaxy-s7-edge-concept-renders-2\/",
        "title": {
            "rendered": "150605_samsung-galaxy-s7-edge-concept-renders-2"
        },
        "author": 4,
        "acf": [],
        "caption": {
            "rendered": ""
        },
        "alt_text": "",
        "media_type": "image",
        "mime_type": "image\/jpeg",
        "media_details": {
            "width": 580,
            "height": 386,
            "file": "2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg",
            "sizes": {
                "thumbnail": {
                    "file": "150605_samsung-galaxy-s7-edge-concept-renders-2-150x150.jpg",
                    "width": 150,
                    "height": 150,
                    "mime_type": "image\/jpeg",
                    "source_url": "http:\/\/www.teknoever\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2-150x150.jpg"
                },
                "medium": {
                    "file": "150605_samsung-galaxy-s7-edge-concept-renders-2-300x200.jpg",
                    "width": 300,
                    "height": 200,
                    "mime_type": "image\/jpeg",
                    "source_url": "http:\/\/www.teknoever\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2-300x200.jpg"
                },
                "full": {
                    "file": "150605_samsung-galaxy-s7-edge-concept-renders-2.jpg",
                    "width": 580,
                    "height": 386,
                    "mime_type": "image\/jpeg",
                    "source_url": "http:\/\/www.teknoever\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg"
                }
            },
            "image_meta": {
                "aperture": "0",
                "credit": "",
                "camera": "",
                "caption": "",
                "created_timestamp": "0",
                "copyright": "",
                "focal_length": "0",
                "iso": "0",
                "shutter_speed": "0",
                "title": "",
                "orientation": "0",
                "keywords": []
            }
        },
        "source_url": "http:\/\/www.teknoever\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg",
        "_links": {
            "self": [{
                "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/media\/7825"
            }],
            "collection": [{
                "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/media"
            }],
            "about": [{
                "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/types\/attachment"
            }],
            "author": [{
                "embeddable": true,
                "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/users\/4"
            }],
            "replies": [{
                "embeddable": true,
                "href": "http:\/\/www.teknoever\/wp-json\/wp\/v2\/comments?post=7825"
            }]
        }
    }]
}
}

i use wp-rest-api v2 plugin. Custom post types doesnt show taxonomy. somebody can tell me whats wrong?

URL: /wp-json/wp/v2/galeri?_embed

{
"id": 275,
"date": "2016-05-07T23:53:17",
"date_gmt": "2016-05-07T20:53:17",
"guid": {
    "rendered": "http:\/\/demo.markamiz.com\/?post_type=galeri&#038;p=275"
},
"modified": "2017-07-21T15:07:24",
"modified_gmt": "2017-07-21T12:07:24",
"slug": "samsung-galaxy-s7-edge",
"status": "publish",
"type": "galeri",
"link": "http:\/\/www.teknoever.com\/galeri\/samsung-galaxy-s7-edge\/",
"title": {
    "rendered": "Samsung Galaxy S7 Edge"
},
"content": {
    "rendered": "<p>Toplam <b>7<\/b> sayfadan <b>1.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-276\" src=\"http:\/\/demo.markamiz.com\/wp-content\/uploads\/2016\/05\/150604_samsung-galaxy-s7-1445005423.jpg\" alt=\"150604_samsung-galaxy-s7-1445005423\" width=\"580\" height=\"356\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>2.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-277\" src=\"http:\/\/demo.markamiz.com\/wp-content\/uploads\/2016\/05\/150604_samsung-galaxy-s7-edge-concept-renders.jpg\" alt=\"150604_samsung-galaxy-s7-edge-concept-renders\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>3.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-278\" src=\"http:\/\/demo.markamiz.com\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-1.jpg\" alt=\"150605_samsung-galaxy-s7-edge-concept-renders-1\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>4.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-279\" src=\"http:\/\/demo.markamiz.com\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg\" alt=\"150605_samsung-galaxy-s7-edge-concept-renders-2\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>5.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-280\" src=\"http:\/\/demo.markamiz.com\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-3-1445005456.jpg\" alt=\"150605_samsung-galaxy-s7-edge-concept-renders-3-1445005456\" width=\"580\" height=\"385\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>6.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-281\" src=\"http:\/\/demo.markamiz.com\/wp-content\/uploads\/2016\/05\/150606_samsung-galaxy-s7-edge-concept-renders-4.jpg\" alt=\"150606_samsung-galaxy-s7-edge-concept-renders-4\" width=\"580\" height=\"386\" \/><br \/>\n<!--nextpage--><br \/>\nToplam <b>7<\/b> sayfadan <b>7.<\/b> sayfadas\u0131n\u0131z.<br \/>\n<img class=\"alignnone size-full wp-image-282\" src=\"http:\/\/demo.markamiz.com\/wp-content\/uploads\/2016\/05\/150606_samsung-galaxy-s7-edge-concept-renders-5-1.jpg\" alt=\"150606_samsung-galaxy-s7-edge-concept-renders-5\" width=\"580\" height=\"386\" \/><\/p>\n",
    "protected": false
},
"excerpt": {
    "rendered": "<p>Y\u0131l\u0131n en dikkat \u00e7ekici modellerinden bir tanesi olan Samsung Galaxy S7 edge, inceleme merkezimizin yeni konu\u011fu oluyor.<br \/>\nSamsung, ge\u00e7ti\u011fimiz y\u0131l sat\u0131\u015fa sundu\u011fu Galaxy S6 ve Galaxy S6 edge modelleriyle tasar\u0131m dilinde ciddi bir de\u011fi\u015fikli\u011fe gitmi\u015f, plastik tasar\u0131m\u0131 tarihin tozlu sayfalar\u0131nda b\u0131rakarak cam ve metal malzemelerle haz\u0131rlanan premium tasar\u0131mlar\u0131 bizlere sunmu\u015ftu. \u00d6zellikle S6 edge ve daha sonra sat\u0131\u015fa sunulan S6 edge+, y\u0131l\u0131n en \u015f\u0131k modelleri aras\u0131nda g\u00f6sterilmi\u015fti.<\/p>\n",
    "protected": false
},
"author": 4,
"featured_media": 7825,
"menu_order": 0,
"comment_status": "open",
"ping_status": "open",
"template": "",
"meta": [],
"acf": [],
"_links": {
    "self": [{
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/galeri\/275"
    }],
    "collection": [{
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/galeri"
    }],
    "about": [{
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/types\/galeri"
    }],
    "author": [{
        "embeddable": true,
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/users\/4"
    }],
    "replies": [{
        "embeddable": true,
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/comments?post=275"
    }],
    "version-history": [{
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/galeri\/275\/revisions"
    }],
    "wp:featuredmedia": [{
        "embeddable": true,
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/media\/7825"
    }],
    "wp:attachment": [{
        "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/media?parent=275"
    }],
    "curies": [{
        "name": "wp",
        "href": "https:\/\/api.w.org\/{rel}",
        "templated": true
    }]
},
"_embedded": {
    "author": [{
        "id": 4,
        "name": "Erdin\u00e7",
        "url": "http:\/\/www.teknoever.com",
        "description": "Uzun y\u0131llar bir\u00e7ok blog ve haber portallar\u0131nda edit\u00f6r olarak \u00e7al\u0131\u015fmas\u0131n\u0131n yan\u0131nda, asp ve php yaz\u0131l\u0131mlar\u0131na olduk\u00e7a hakim ve bir\u00e7ok projede b\u00fcy\u00fck ba\u015far\u0131lara imza atm\u0131\u015ft\u0131r. Edit\u00f6rl\u00fck kariyerinde \u015fimdi Tekno Ever ile devam etmektedir.Referanslar i\u00e7in l\u00fctfen markamiz.com'u ziyaret ediniz.",
        "link": "http:\/\/www.teknoever.com\/yazar\/erdinc\/",
        "slug": "erdinc",
        "avatar_urls": {
            "24": "http:\/\/2.gravatar.com\/avatar\/b37cac9cdbbc2f7cdae3348e514a305b?s=24&d=mm&r=g",
            "48": "http:\/\/2.gravatar.com\/avatar\/b37cac9cdbbc2f7cdae3348e514a305b?s=48&d=mm&r=g",
            "96": "http:\/\/2.gravatar.com\/avatar\/b37cac9cdbbc2f7cdae3348e514a305b?s=96&d=mm&r=g"
        },
        "acf": [],
        "_links": {
            "self": [{
                "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/users\/4"
            }],
            "collection": [{
                "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/users"
            }]
        }
    }],
    "wp:featuredmedia": [{
        "id": 7825,
        "date": "2016-09-06T17:31:52",
        "slug": "150605_samsung-galaxy-s7-edge-concept-renders-2",
        "type": "attachment",
        "link": "http:\/\/www.teknoever.com\/galeri\/samsung-galaxy-s7-edge\/150605_samsung-galaxy-s7-edge-concept-renders-2\/",
        "title": {
            "rendered": "150605_samsung-galaxy-s7-edge-concept-renders-2"
        },
        "author": 4,
        "acf": [],
        "caption": {
            "rendered": ""
        },
        "alt_text": "",
        "media_type": "image",
        "mime_type": "image\/jpeg",
        "media_details": {
            "width": 580,
            "height": 386,
            "file": "2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg",
            "sizes": {
                "thumbnail": {
                    "file": "150605_samsung-galaxy-s7-edge-concept-renders-2-150x150.jpg",
                    "width": 150,
                    "height": 150,
                    "mime_type": "image\/jpeg",
                    "source_url": "http:\/\/www.teknoever.com\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2-150x150.jpg"
                },
                "medium": {
                    "file": "150605_samsung-galaxy-s7-edge-concept-renders-2-300x200.jpg",
                    "width": 300,
                    "height": 200,
                    "mime_type": "image\/jpeg",
                    "source_url": "http:\/\/www.teknoever.com\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2-300x200.jpg"
                },
                "full": {
                    "file": "150605_samsung-galaxy-s7-edge-concept-renders-2.jpg",
                    "width": 580,
                    "height": 386,
                    "mime_type": "image\/jpeg",
                    "source_url": "http:\/\/www.teknoever.com\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg"
                }
            },
            "image_meta": {
                "aperture": "0",
                "credit": "",
                "camera": "",
                "caption": "",
                "created_timestamp": "0",
                "copyright": "",
                "focal_length": "0",
                "iso": "0",
                "shutter_speed": "0",
                "title": "",
                "orientation": "0",
                "keywords": []
            }
        },
        "source_url": "http:\/\/www.teknoever.com\/wp-content\/uploads\/2016\/05\/150605_samsung-galaxy-s7-edge-concept-renders-2.jpg",
        "_links": {
            "self": [{
                "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/media\/7825"
            }],
            "collection": [{
                "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/media"
            }],
            "about": [{
                "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/types\/attachment"
            }],
            "author": [{
                "embeddable": true,
                "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/users\/4"
            }],
            "replies": [{
                "embeddable": true,
                "href": "http:\/\/www.teknoever.com\/wp-json\/wp\/v2\/comments?post=7825"
            }]
        }
    }]
}
}
Share Improve this question asked Jul 30, 2017 at 18:58 Erdinç TazeErdinç Taze 11 silver badge3 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

Check your custom post type and custom taxonomy arguments arrays and make sure 'show_in_rest' is set to true in both.

I solved my problem. Solution is below, if anybody have this issue just add below codes in functions.php and type taxonomy name taxonomy_name variable

add_action( 'init', 'my_custom_taxonomy_rest_support', 25 );
function my_custom_taxonomy_rest_support() {
global $wp_taxonomies;
//be sure to set this to the name of your taxonomy!
$taxonomy_name = 'galeri-kategori';
if ( isset( $wp_taxonomies[ $taxonomy_name ] ) ) {
$wp_taxonomies[ $taxonomy_name ]->show_in_rest = true;

// Optionally customize the rest_base or controller class
$wp_taxonomies[ $taxonomy_name ]->rest_base = $taxonomy_name;
$wp_taxonomies[ $taxonomy_name ]->rest_controller_class = 'WP_REST_Terms_Controller';
}
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736258861a545.html

最新回复(0)